Concatenate Tables with/without "Join"

1 visualización (últimos 30 días)
Dario Walter
Dario Walter el 17 de Jun. de 2019
Comentada: Dario Walter el 18 de Jun. de 2019
Hey guys,
I could really need your help right now!
Let us assume
A = table(['A';'B';'C';'D';'E'],[38;43;38;40;49],...
'VariableNames',{'Character' 'Time1'})
B = table(['A';'C';'D';'E';'F'],[92;46;29;50;57],...
'VariableNames',{'Character' 'Time2'})
I want to create table in such a way that it returns
C=table(['A';'B';'C';'D';'E';'F'],[38;43,38;40;49;nan],[92;nan;46;29;50;57])
Do you have any idea? Thanks for your help!
  2 comentarios
Matt J
Matt J el 17 de Jun. de 2019
Your code to generate C generates an error
>> C=table(['A';'B';'C';'D';'E';'F'],[38;43,38;40;49;nan],[92;nan;46;29;50;57])
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
And what do you mean by "with/without Join"? Do you mean either is acceptable?
Dario Walter
Dario Walter el 17 de Jun. de 2019
Please apologize, there was a comma instead of a semicolon.
C=table(['A';'B';'C';'D';'E';'F'],[38;43;38;40;49;nan],[92;nan;46;29;50;57])
Exactly, I do not mind how it works. It just has work.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 17 de Jun. de 2019
Editada: Matt J el 17 de Jun. de 2019
>> C = outerjoin(A,B,'Keys','Character','MergeKeys',true)
C =
6×3 table
Character Time1 Time2
_________ _____ _____
A 38 92
B 43 NaN
C 38 46
D 40 29
E 49 50
F NaN 57

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by