Borrar filtros
Borrar filtros

Copy data from cell array to table

23 visualizaciones (últimos 30 días)
Benjamin Lemmer
Benjamin Lemmer el 19 de Feb. de 2019
Editada: Adam Danz el 24 de Feb. de 2019
I am having a 1x12 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 1x12 table instead ot the wanted 18977x12 table. What am I doing wrong ?

Respuesta aceptada

Adam Danz
Adam Danz el 19 de Feb. de 2019
Editada: Adam Danz el 24 de Feb. de 2019
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().

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by