merge 2 tables both have the same variable name

조회 수: 24 (최근 30일)
Bayu Ardiyanto
Bayu Ardiyanto 2018년 5월 9일
댓글: Peter Perkins 2018년 5월 14일
Hi, I have 2 tables, for example table a:
var_a var_b
1 a
2 b
table b:
var_a var_b
3 c
4 d
They have the same variable names for both of the tables but different value. I want to merge those 2 table into table c which is:
var_a var_b
1 a
2 b
3 c
4 d
I think it's quite easy problem but didn't found the simple way to do it. Thank you!

채택된 답변

Stephen23
Stephen23 2018년 5월 9일
편집: Stephen23 2018년 5월 9일
vertcat(A,B)
From the vertcat help: "If the inputs are tables, vertcat concatenates by matching variable names. Variable names for all tables must be identical, except for order. Row names, when present, must be unique across tables."
  댓글 수: 2
Bayu Ardiyanto
Bayu Ardiyanto 2018년 5월 9일
Thanks!
Peter Perkins
Peter Perkins 2018년 5월 14일
Also written as
[A; B]
In other words, just like what you'd do with most other kinds of MATLAB array.

댓글을 달려면 로그인하십시오.

추가 답변 (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