MATLAB: How to paste nicely into Excel from MATLAB variable editor

excelMATLAB

One can readily paste data from Excel into a MATLAB cell array in the variable editor using Paste Excel Data (Ctrl-Shift-V), but how exactly does one reverse this operation?
I find cells that contain [] become strings in Excel, where I expect blank cells, and strings get unwanted quotes at the start and end.
The net result of this is if you copy and paste some cells in Excel comprising some text, some numeric and some blanks into a MATLAB cell array – it looks fine in MATLAB – but when you copy back to Excel you don't have what you started out with.
Easy copy / paste between Excel and MATLAB should be a breeze in 2015, shouldn't it? What am I doing wrong? Perhaps there is or needs to be a "Copy Excel Data" function to match "Paste Excel Data" (although it is nicer to just use standard Ctrl+C, Ctrl+V)?
Thanks for reading this.

Best Answer

It is not directly possible. From Mathworks:
I understand that you would like to paste cells with strings from the MATLAB Variables editor to Microsoft Excel, but noted some inconsistencies to-from copy/paste operations. Specifically, you found that copying from MATLAB to Excel in this way introduces single quotation marks and empty square brackets depending on whether or not the cell element has a string or is an empty matrix.
Unfortunately, while the MATLAB Variables editor has a context menu item to paste values from Excel, I do not think there is an immediate option in Microsoft Excel to paste from MATLAB. I tried using Excel's Text Import Wizard to perform this paste operation into Excel, but unfortunately none of the options I explored worked.
That said, I can think of two possible workarounds to working between MATLAB and Excel without the use of "xlsread/xlswrite" or "readtable/writetable": 1. Copy the cell array from the MATLAB Variables editor, and then paste to Excel as you have done before. Then, from Excel, press Ctrl+F to Find/Replace all single quotes and square brackets [] with empty strings. 2. Consider using MathWork's Spreadsheet Link EX to use MATLAB from Microsoft Excel. The following link provides a high-level overview of Spreadsheet Link EX and its available features: http://www.mathworks.com/products/excellink/