How concatenate two tables in MATLAB?
578 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Adriano
el 19 de Nov. de 2016
Comentada: Douglas Novaes
el 12 de Sept. de 2022
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 comentario
Ravi Raj Pareek
el 19 de Mzo. de 2021
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
Respuesta aceptada
Peter Perkins
el 23 de Nov. de 2016
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 comentarios
Peter Perkins
el 30 de Abr. de 2020
Horizontal concatenation of tables will not merge variables. You need to say exactly what you started from and what you did.
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!