MATLAB: How to export a cell array, into excel, with elements of different sizes

cellexcelxls

I have a cell whose cells are vector of different sizes. As an example:
cell ={[50×1 double] [32×1 double] [288×1 double]}
How do I export this into an excel file, and in each column of the excel file goes a vector? I only could make with one element of the cell, because of the different sizes of the contents of the cell.
Thanks already

Best Answer

You have to extract the arrays from each cell and put them into individual cells. So, for example with the first cell, you need to do something like
theArray = originalCellArray{1}; % Extract first cell.
ca = cell(288,3);
for row = 1 : size(theArray, 1)
ca{row,1} = theArray(row);
end
Do that for each of your 3 cells. You can have them all in one cell.
theArray = originalCellArray{2}; % Extract second cell.
for row = 1 : size(theArray, 1)
ca{row,2} = theArray(row);
end
theArray = originalCellArray{3}; % Extract third cell.
for row = 1 : size(theArray, 1)
ca{row,3} = theArray(row);
end
xlswrite(filename, ca);
You might want to read this before you start (in case I programmed something up incorrectly - I didn't test it): http://matlab.wikia.com/wiki/FAQ?title=FAQ&cb=8838#What_is_a_cell_array.3F