How can I convert this table to a cell array as shown in the screenshot?

2 ビュー (過去 30 日間)
zhongjie
zhongjie 2019 年 9 月 2 日
コメント済み: zhongjie 2019 年 9 月 6 日
I have a CSV file that looks like thistable.jpg and I would like to convert it to two cell arrays by id.
cell1.jpg
One array contains all "t" of the same id (shown above), and the other array contains all "measure" of the same id as shown below
.cell2.jpg

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 9 月 5 日
編集済み: Andrei Bobrov 2019 年 9 月 6 日
tout = varfun(@(x){x(:)'},T,'GroupingVariables','id');
C = tout{:,3:end};
measure = C(:,1);
t = C(:,2);
  4 件のコメント
Andrei Bobrov
Andrei Bobrov 2019 年 9 月 6 日
編集済み: Andrei Bobrov 2019 年 9 月 6 日
I'm fix (about transpose).
Maybe accept it answer? Or ...
zhongjie
zhongjie 2019 年 9 月 6 日
Sorry I'm new to this community, didn't really notice that "Accept this answer" button. My bad!

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

その他の回答 (1 件)

Anmol Dhiman
Anmol Dhiman 2019 年 9 月 5 日
Use the following commands
T = readtable('filename.csv')
c{1} = T{T.id==1,'measure'}
c{2} = T{T.id==2,'measure'}
  1 件のコメント
zhongjie
zhongjie 2019 年 9 月 5 日
編集済み: zhongjie 2019 年 9 月 5 日
Thank you very much for the answer!

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

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by