How can I convert this table to a cell array as shown in the screenshot?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a CSV file that looks like this and I would like to convert it to two cell arrays by id.
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
.
0 件のコメント
採用された回答
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
2019 年 9 月 6 日
編集済み: Andrei Bobrov
2019 年 9 月 6 日
I'm fix (about transpose).
Maybe accept it answer? Or ...
その他の回答 (1 件)
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'}
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!