Effacer les filtres
Effacer les filtres

Copy data from cell array to table

23 vues (au cours des 30 derniers jours)
Benjamin Lemmer
Benjamin Lemmer le 19 Fév 2019
Modifié(e) : Adam Danz le 24 Fév 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 ?

Réponse acceptée

Adam Danz
Adam Danz le 19 Fév 2019
Modifié(e) : Adam Danz le 24 Fév 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().

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by