writecell to excel when cell elements are matrixes

4 ビュー (過去 30 日間)
george hargenrader
george hargenrader 2020 年 5 月 1 日
編集済み: Adam Danz 2020 年 5 月 4 日
I have a 1x4 cell and each element is an nxm matrix, each matrix may or may not be different dimentions. I want to save this data to a file and I think the best is to store each matrix into a sheet of an excel file. Is there an elegant way to do this? I can only thing to do it with loops.
  3 件のコメント
george hargenrader
george hargenrader 2020 年 5 月 2 日
1) I need to send it to collaborators who are not using matlab.
2) They will plot it in other software and make it pretty for publication.
I think the looping part will be simpler than I thought. Now I'm just trying to figure out the best way to give the columns header labels. I think writematrix does not support 'append' in 2019a.
george hargenrader
george hargenrader 2020 年 5 月 2 日
It turned out to be simple, I just wish I could use append rather than think about what row to start on using the 'Range' command.
for i=1:N_temps
writematrix(Header(i,:),strcat(FileP,'MeBIMH_out_data.xlsx'),'sheet',i);
writematrix(data{i},strcat(FileP,'MeBIMH_out_data.xlsx'),'sheet',i,'Range','A2');
end

サインインしてコメントする。

回答 (1 件)

Adam Danz
Adam Danz 2020 年 5 月 2 日
編集済み: Adam Danz 2020 年 5 月 4 日
"I just wish I could use append rather than think about what row to start on using the 'Range' command."
The Matlab Genie has made your wish come true.
Update to r2020a and you can append an excel file using writematrix as reported in the r2020a release notes.
Example:
writematrix(M,'M.xls','WriteMode','append')

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by