Export cell array xlswrite

1 次查看(过去 30 天)
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 个)

Community Treasure Hunt

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

Start Hunting!

Translated by