export a cell array with same size matrices to excel

조회 수: 3 (최근 30일)
Melody Lyu
Melody Lyu 2020년 2월 12일
댓글: fred ssemwogerere 2020년 2월 12일
I have a 1x23 cell with matrices inside:
30x30 double 30x30 double 30x30 double ...
How to export this cell array with matrices on excel? I want each 30x30 matrix a seperate sheet so I will have 23 sheets for the cell array.

채택된 답변

fred  ssemwogerere
fred ssemwogerere 2020년 2월 12일
Hello, something like this should do nicely:
% Taking "C" to be your cell array, and your excel file as: "myfile.xlsx"
for k=1:size(C,2)
xlswrite('myfile.xlsx',C{k},'Sheet',k);
end
  댓글 수: 2
Melody Lyu
Melody Lyu 2020년 2월 12일
Thanks, this looks right but I am getting an error:
"Error using xlswrite (line 170)
Range argument must be specified as a string scalar or
character vector in Excel A1 notation.
Error in directoryData (line 86)
xlswrite('myfile.xlsx',C{i},'Sheet',i);"
fred  ssemwogerere
fred ssemwogerere 2020년 2월 12일
Hello, sorry my mistake. Change the code to this:
% Taking "C" to be your cell array, and your excel file as: "myfile.xlsx"
for k=1:size(C,2)
xlswrite('myfile.xlsx',C{k},k); % I have removed the string "Sheet".
end

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by