How to export cell array of strings and doubles in Excel?

조회 수: 3 (최근 30일)
theblueeyeswhitedragon
theblueeyeswhitedragon 2018년 9월 20일
댓글: theblueeyeswhitedragon 2018년 9월 21일
I am trying to export a cell array which contains both double and string elements with the xlswrite() function.
All the double elements were exported, but many string elements are missing. For instance, column 3 is supposed to have string elements and the empty cells between aaa and bbb should contain strings too. The size of the array I tried to export through the xlswrite() function is 723 x 25, so I was curious to know what is causing this error. I tested the same function on a smaller sized array m = {1, 'a', 'b';2, 'c', 'd';3, 'e', 'f';4, 'g', 'h'} and all the cell elements were exported in Excel. Is this error related to the size of array?
  댓글 수: 3
dpb
dpb 2018년 9월 20일
As G says, it's owing to the array structure.
>> help xlswrite
xlswrite Write to Microsoft Excel spreadsheet file.
xlswrite(FILE,ARRAY) writes ARRAY to the first worksheet in the
Excel file named FILE, starting at cell A1.
...
...
Input Arguments:
FILE Name of the file to write. ...
ARRAY Two-dimensional numeric or character array or, if each cell
contains a single element, a cell array.
...
NB: the last restriction on the output ARRAY
theblueeyeswhitedragon
theblueeyeswhitedragon 2018년 9월 21일
Yes, there were char arrays wrapped inside scalar cells just like you proposed. This happened when I processed the data and stored in the cell array. Thank you for the feedback.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by