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 Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by