How to separate table columns by groups?
Show older comments
If I have a table of data (T1) such as:
Var1 Var2
1 xyz
1 xyy
2 xxx
2 xzx
3 xyy
4 yzy
4 xzz
4 yzz
I would like to output another table (T2):
Var1 Var2
1 xyz,xyy
2 xxx,xzx
3 xyy
4 yzy,xzz,yzz
I have unsuccessfully used unstack, since it creates the values in Var2 as column names. Any suggestions would be much appreciated.
3 Comments
dpb
on 20 Jun 2018
Is Var2 numeric?
Denis Pesacreta
on 20 Jun 2018
Denis Pesacreta
on 20 Jun 2018
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!