Combine table variables and assign head-variable name

12 ビュー (過去 30 日間)
Niclas Madsen
Niclas Madsen 2019 年 1 月 21 日
回答済み: Niclas Madsen 2019 年 1 月 21 日
Hi
I'm trying to concatenate tables together. I have two variables that I combine together in multiple combinations, and each combination can have n solutions. For testing purposes I've kept it short and simple. Right now I have 5 combinations each with 3 solutions.
Using MS Paint magic I've edited the table to look like what I want
Unavngivet.png
I'm pretty sure I've seen a way to do this, but I can't find the page any longer.
Don't worry about 2&3 and 4&5 being identical.
Any help would be appriciated.
  1 件のコメント
madhan ravi
madhan ravi 2019 年 1 月 21 日
upload your tables as .mat files so that the problem is pretty clear

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 21 日

その他の回答 (2 件)

Steven Lord
Steven Lord 2019 年 1 月 21 日
t1 = array2table(magic(3), 'VariableNames', {'Col1', 'Col2', 'Col3'})
t2 = array2table(eye(3))
t3 = table(t1, t2, 'VariableNames', {'subtable1', 'subtable2'})
t3.Properties.RowNames = {'huey', 'dewey', 'louie'}
To extract data:
t3{'huey', 'subtable1'}.Col1 % or
t3.subtable1{'huey', 'Col1'}

Niclas Madsen
Niclas Madsen 2019 年 1 月 21 日
Thank you all!
I'll get this working

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by