Table formatting to combine the variable names as sub header

3 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by