フィルターのクリア

how to import cell array with different sizes into excel

1 回表示 (過去 30 日間)
Yussif M. Awelisah
Yussif M. Awelisah 2019 年 10 月 29 日
コメント済み: Walter Roberson 2019 年 11 月 1 日
I have 200 samples of cell array data with different sizes but same length.
eg 3x500
6x500
2x500 etc
Please how can I import these data into excel.

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 10 月 29 日
A typical way to handle that would be to write each one to a different sheet.
Another way would be to put everything together in one matrix, with an additional column indicating which matrix it belongs to
1 .... 500 columns
1 .... 500 columns
1 .... 500 columns
2 .... 500 columns
[another 4 of those and then]
2 .... 500 columns
3 .... 500 columns
3 .... 500 columns
4 .... 500 columns etc
  3 件のコメント
Yussif M. Awelisah
Yussif M. Awelisah 2019 年 11 月 1 日
@Water Roberson
Please your suggestions earlier can save my modeling results.
Please I wil be grateful if you can help me how I can achieve your answer earlier especially the second option.
Thank you.
Walter Roberson
Walter Roberson 2019 年 11 月 1 日
A = [];
for K = 1 : numel(x)
t = x{K};
start = size(A,1);
stop = start + size(t,1) - 1;
A(start:stop, 1) = K;
A(start:stop, 2:1+size(t,2)) = t;
end
The above code uses zero padding. It is possible to do NaN padding, but takes a few more lines.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by