How concatenate two tables in MATLAB?

807 ビュー (過去 30 日間)
Adriano
Adriano 2016 年 11 月 19 日
コメント済み: Douglas Novaes 2022 年 9 月 12 日
I have two tables with no variables in common, with the same number of rows and with different number of columns. For example:
Age Height
___ ______
38 71
43 69
and the table:
Weight Blood
______ ______
176 124
163 109
How can I get:
Age Height Weight Blood
___ ______ ______ _____
38 71 176 124
43 69 163 109
Thanks!
  1 件のコメント
Ravi Raj Pareek
Ravi Raj Pareek 2021 年 3 月 19 日
use below command and check if it works:
T = join(Tleft,Tright)
where Tleft is, table with Age and height column
and Tright is, table with weight and blood

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

採用された回答

Peter Perkins
Peter Perkins 2016 年 11 月 23 日
Adriano, to horizontally concatenate anything in MATLAB, you would probably just use square brackets, right? Such as AB = [A B]. Same for tables. cat and horzcat provide a functional form of that, but the standard MATLAB way is brackets.
  3 件のコメント
Peter Perkins
Peter Perkins 2020 年 4 月 30 日
Horizontal concatenation of tables will not merge variables. You need to say exactly what you started from and what you did.
Douglas Novaes
Douglas Novaes 2022 年 9 月 12 日
Perfect! Thank you!

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

その他の回答 (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