xlswrite

7 views (last 30 days)
New
New on 31 Mar 2011
Hi,
I am trying to write a cell array (1718x142 cell) back to xls. Neither xlswrite command nor a simple manual copy paste works. I think my problem is that the cell array itself is composed of individual single cell arrays of short strings or empty cell. I would like to have an advise how to convert to a single layer cell array that I can then copy to xls.
Thank you in advance

Accepted Answer

Titus Edelhofer
Titus Edelhofer on 31 Mar 2011
If the entries in your cell array are indeed 1x1 cells of strings or empty cells, try to convert each cell entry to a string: xConverted = cellfun(@char, xOriginal, 'Uniformoutput', false);
Titus
  2 Comments
Michael Neal
Michael Neal on 17 May 2012
If I had a matrix that consisted of both strings and numbers, would I want to rewrite the numbers as strings to the matrix?
Image Analyst
Image Analyst on 17 May 2012
No, you can have both in one cell array, though you can do it that way if you want. The complication was that instead of the "string cells" in your cell array containing simple strings, they contained a cell array that contained a string. That's an extra layer of cells that you most likely don't need. Likewise, the "number cells" in your cell array should contain a number directly, not a cell that contains a number.

Sign in to comment.

More Answers (0)

Categories

Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!