Export cell array xlswrite

1 回表示 (過去 30 日間)
Ali N
Ali N 2020 年 1 月 21 日
回答済み: Jakob B. Nielsen 2020 年 1 月 21 日
Hello all
I have cell arrey, each cell has a different dimention. I just want to Exports these cells one after another in a Excel file. Is there anyway to do that witha single line code or a loop. I can not do this with a single xlswrite.
Thanks

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2020 年 1 月 21 日
Looping is the way to go. Depending on the dimensions of your cell you need to modify this, but for an example cell array named X with 2 cells, the first a 1x4 and the next a 1x7;
for i=1:size(X,2)
range=strcat('A',num2str(i),':A',num2str(i)); %write from excel cell A1 on the first run, A2 next run etc.
xlswrite(X{i,1},)
end
If some cells in your cell array are 2D, you will need to adjust accordingly. Note for this specific example your cells need to be rows - if they are columns, simply put a ' next to it.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by