Is there a way to reshape or transform a table 7×3 table into a table with as many columns as the unique elements of a cell column?
Orignal table 7×3 (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,3×3, for only AAA would be
Table2=
1 AAA 100
2 AAA 250
3 AAA 500
A subtable, 4×3, for only BBB would be
Table3=
1 BBB 300
2 BBB NaN
3 BBB 100
4 BBB 50
The target table, 4×3, 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 …
Best Answer