필터 지우기
필터 지우기

Copy data from cell array to table

조회 수: 23 (최근 30일)
Benjamin Lemmer
Benjamin Lemmer 2019년 2월 19일
편집: Adam Danz 2019년 2월 24일
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 ?

채택된 답변

Adam Danz
Adam Danz 2019년 2월 19일
편집: Adam Danz 2019년 2월 24일
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().

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by