MATLAB: Copy data from cell array to table

array2tablecell arrayMATLABtable

I am having a 1×12 cell array, that contains different data:
1×12 cell array
Columns 1 through 7
{18977×1 string} {18977×1 string} {18977×1 string} {18977×1 double} {18977×1 double} {18977×1 double} {18977×1 double}
Columns 8 through 12
{18977×1 double} {18977×1 double} {18977×1 double} {18977×1 double} {18977×1 string}
I want to convert it into a table so that I can select complete rows or plot a column. But the command
t = array2table(dataArray);
t2 = cell2table(dataArray);
still leave me with a 1×12 table instead ot the wanted 18977×12 table. What am I doing wrong ?

Best Answer

Here are some fake data that look similar to yours.
A = {string(rand(18977,1)), rand(18977,1), rand(18977,1), rand(18977,1)};
And here's how to put those data into a table (assuming all elements of the cell array have the same number of rows).
table(A{:}) %use the 'VariableNames' option to add headers
If vectors are not of equal length, use padarray().