Q:

Exporting huge matrices from Matlab

I have a few values generated in Matlab by 
for count =  1:30

-Do stuff-

Data{Count} = [Multiple values] %here

end %Count

I'm trying to copy this large chunk of data to MS Excel, but I always get this:

...and then I have to open every matrix in each cell one by one to extract their values. I would love to see all the matrices when I open the variable in Matlab, something like this: 

and easily copy and paste them into excel, which is why I segregated them into 1, 2, 3... in the first place.
Any opinions? Matlab Ver 2010b.

A:

So you are storing your data in a cell array, and I assume your Data{c} are column vectors, for example:
    data    = cell(1,2);
    data{1} = [1; 2; 3; 4];
    data{2} = [5; 6; 7; 8];

From here, you can construct a table via
    T = table(data{1},data{2},'VariableNames',{'sample1','sample2'});

or, for larger data sets,
    T = array2table(cell2mat(data));

This assumes an equal number of entries in each of your cells, else you will run into a concatenation error using cell2mat. One workaround here would be to pad your data{c} with zeros to get consistent dimensions, although this could mess up you data analysis.
In the case of varying numbers of entries in each data{c}, I would suggest instead that you store each data value
in a separate cell, i.e.
    for c = 1:n
    ...
    values = [some values];        
        for r = 1:length(values)        
            data{r,c} = values(r);    
        end
    end 

and use the cell2table() function:
    T = cell2table(data);

You can then export to Excel via
    filename = 'test.xlsx';
    writetable(T,filename) 

