merge 2 tables both have the same variable name

25 visualizaciones (últimos 30 días)
Bayu Ardiyanto
Bayu Ardiyanto el 9 de Mayo de 2018
Comentada: Peter Perkins el 14 de Mayo de 2018
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!

Respuesta aceptada

Stephen23
Stephen23 el 9 de Mayo de 2018
Editada: Stephen23 el 9 de Mayo de 2018
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 comentarios
Bayu Ardiyanto
Bayu Ardiyanto el 9 de Mayo de 2018
Thanks!
Peter Perkins
Peter Perkins el 14 de Mayo de 2018
Also written as
[A; B]
In other words, just like what you'd do with most other kinds of MATLAB array.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by