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
  1 件のコメント
Dario Walter
Dario Walter 2019 年 6 月 18 日
Thank you very much Matt!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by