Table: Reshape based on Cell Column and Sort
Show older comments
Is there a way to reshape or transform a table 7x3 table into a table with as many columns as the unique elements of a cell column?
Orignal table 7x3 (var1 double, var2 cell, var3 double)
Table1=
1 AAA 100
3 AAA 500
1 BBB 300
2 AAA 250
4 BBB 50
2 BBB NaN
3 BBB 100
A sub table,3x3, for only AAA would be
Table2=
1 AAA 100
2 AAA 250
3 AAA 500
A subtable, 4x3, for only BBB would be
Table3=
1 BBB 300
2 BBB NaN
3 BBB 100
4 BBB 50
The target table, 4x3, is
Table4=
1 100 300
2 250 NaN
3 500 100
4 NaN 50
I do not need table 2 and 3, only interested in table 4. Table 4 keeps the first column and following columns refer to the AAA BBB ...
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!