Using the outerjoin to join more than 2 tables

14 ビュー (過去 30 日間)
Mark Rodger
Mark Rodger 2018 年 1 月 30 日
コメント済み: Devin kIM 2020 年 11 月 9 日
I want to join multiple tables together to make one table. I've used the outerjoin function to join 2 tables together(shown below). Is there anyway to join more than 2 tables using the outerjoin function.
c = outerjoin(data{1,1},data{1,3},'Keys','time','MergeKeys',true);
  2 件のコメント
Jan
Jan 2018 年 1 月 30 日
No, you did not use the outerjoin function, but the join function.
Mark Rodger
Mark Rodger 2018 年 1 月 30 日
Yeah, meant to say join instead of outerjoin

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

回答 (1 件)

Jan
Jan 2018 年 1 月 30 日
編集済み: Jan 2018 年 6 月 8 日
You can nest the joining:
outerjoin(A, outerjoin(B, C))
[EDITED] With a loop:
function Joined = MultiOuterJoin(varargin)
Joined = varargin{1};
for k = 2:nargin
Joined = outerjoin(Joined, varargin{k});
end
end
  3 件のコメント
Jan
Jan 2018 年 6 月 8 日
編集済み: Jan 2018 年 6 月 8 日
@Nick George: No, I'm not joking. All I did was to show, that it is easy to call outerjoin multiple times. If this is done recursively of by a loop does not matter, because the point is the iterative joining.
See EDITED.
Devin kIM
Devin kIM 2020 年 11 月 9 日
I gotta agree with Nick on this one... This can be done in virtually all analysis languages, why is joining multiple tables not available in 2020b? Seems like something that should have been available a long time ago instead of adding more flashy features...

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

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by