Table formatting to combine the variable names as sub header

조회 수: 3 (최근 30일)
ppp
ppp 2019년 7월 9일
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