MATLAB: Exporting cell arrays with different sizes to excel

cellarray

I have cell array of size 774 X1 , and each array has another of one row and varying number of column. so my question is how i can export data from this cell array to a excel file.

Best Answer

What kind of data is contained within the inner cells? If there are more arrays I think you will likely have some problems. Here is what I thought of for a first attempt.
Cell = % Your cell with data
[row,col] = size(Cell);
for k = 1:row;
lengths(row) = size(Cell{k},2);
end
col = max(lengths)
Block = cell(row,col);
for k = 1:row;
Block{k,1:size(Cell{k},2)} = Cell{k};
end
Theoretically, this will "bump" the contents of each cell up a level, so that you have a new cell matrix that doesn't contain further matrices, and you can print it to a 2D excel range.
You might also look at cell2mat for cell arrays that contain doubles.