How can I convert this table to a cell array as shown in the screenshot?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
zhongjie
am 2 Sep. 2019
Kommentiert: zhongjie
am 6 Sep. 2019
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 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 5 Sep. 2019
Bearbeitet: Andrei Bobrov
am 6 Sep. 2019
tout = varfun(@(x){x(:)'},T,'GroupingVariables','id');
C = tout{:,3:end};
measure = C(:,1);
t = C(:,2);
4 Kommentare
Andrei Bobrov
am 6 Sep. 2019
Bearbeitet: Andrei Bobrov
am 6 Sep. 2019
I'm fix (about transpose).
Maybe accept it answer? Or ...
Weitere Antworten (1)
Anmol Dhiman
am 5 Sep. 2019
Use the following commands
T = readtable('filename.csv')
c{1} = T{T.id==1,'measure'}
c{2} = T{T.id==2,'measure'}
1 Kommentar
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!