When I tried using xlswrite for a cell array 4X10 or so with strings of different lengths in each element, MATLAB returned this error:
Error using xlswrite (line 188)
An error occurred on data export in CSV format.
Caused by:
Error using dlmwrite (line 118)
The input cell array cannot be converted to a matrix.
What I boiled it down to is that somewhere in the "dlmwrite" function that is called by "xlswrite", it calls "cell2mat" which will concatenate the elements of my cell array to a character array. However, it will concatenate the elements vertically and horizontally, and it is not possible to concatenate character elements vertically if they do not have the same length. You will end up with an array on inconsistent dimensions. For example,
If I have 'abcdef' and 'abc', concatenating them vertically would give:
abcdef
abc
The first row has a length of 6, and the second row has a length of 3, which does not make logical sense if you're talking about a matrix, which should be 2X6 in this case.
Does anybody know a workaround for this? I'm pretty frustrated with this glitch in MATLAB.