Concatenate Tables with/without "Join"

조회 수: 1 (최근 30일)
Dario Walter
Dario Walter 2019년 6월 17일
댓글: Dario Walter 2019년 6월 18일
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
Matt J
Matt J 2019년 6월 17일
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 2019년 6월 17일
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.

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

채택된 답변

Matt J
Matt J 2019년 6월 17일
편집: Matt J 2019년 6월 17일
>> 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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by