フィルターのクリア

putting columns together as a table

1 回表示 (過去 30 日間)
AA
AA 2014 年 11 月 3 日
コメント済み: Star Strider 2014 年 11 月 3 日
Hi guys, I have got several variables: a, b, c, d, e. They are all cell arrays and consist of one column and several million rows. I want to put them together as one table. How can I do that? I want it in the following order: abcde.
Thanks

採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 11 月 3 日
編集済み: Mohammad Abouali 2014 年 11 月 3 日
a={rand(10,1)};
b={rand(10,1)};
c={rand(10,1)};
T=table();
T.a=cell2mat(a)
T.b=cell2mat(b)
T.c=cell2mat(c)
T =
a b c
________ ________ ________
0.95717 0.84913 0.27692
0.48538 0.93399 0.046171
0.80028 0.67874 0.097132
0.14189 0.75774 0.82346
0.42176 0.74313 0.69483
0.91574 0.39223 0.3171
0.79221 0.65548 0.95022
0.95949 0.17119 0.034446
0.65574 0.70605 0.43874
0.035712 0.031833 0.38156
Note that a and b and c must have same number of rows though.

その他の回答 (1 件)

Star Strider
Star Strider 2014 年 11 月 3 日
See if the cell2table function will do what you want.
  4 件のコメント
Mohammad Abouali
Mohammad Abouali 2014 年 11 月 3 日
編集済み: Mohammad Abouali 2014 年 11 月 3 日
@StarRider: That doesn't actually work Here is the output
a = {rand(5,1)};
b = {rand(7,1)};
z = {a b};
T = cell2table(z);
>> T
T =
z1 z2
____________ ____________
[5x1 double] [7x1 double]
z would be a cell array with elements being cell array
Star Strider
Star Strider 2014 年 11 月 3 日
It works. That much is certain.
What we don’t yet know is if it meets AA’s requirements.

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

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by