How concatenate two tables in MATLAB?
조회 수: 794 (최근 30일)
이전 댓글 표시
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
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
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
2020년 4월 30일
Horizontal concatenation of tables will not merge variables. You need to say exactly what you started from and what you did.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!