Table formatting to combine the variable names as sub header
3 views (last 30 days)
Show older comments
Hallo everyone,
I am trying to get my table in particular format, but i am unable to figure out the best possible way.
here is a small example: Consider a table 't' with the following contents:
name = {'square';'circle';'triangle';'square';'circle'};
list = {'A';'B';'A';'C';'C'};
corners = [4;0;3;4;0];
no = [1;4;10;23;2];
t = table(name,list,corners,no)
t =
name list corners no
__________ ____ _______ __
'square' 'A' 4 1
'circle' 'B' 0 4
'triangle' 'A' 3 10
'square' 'C' 4 23
'circle' 'C' 0 2
from this i need to arrive at a table structure which looks like this:
t =
name A B C
__________ corners no_ corners no corners no
'square' 4 1 0 0 4 23
'circle' 0 0 0 4 0 2
'triangle' 3 10 0 0 0 0
I tried using unstack but its not compatible for this i guess, so any other suggestions?
Thank u all in advance
0 Comments
Answers (0)
See Also
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!