Using the outerjoin to join more than 2 tables

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.
Yeah, meant to say join instead of outerjoin

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

답변 (1개)

Jan
Jan 2018년 1월 30일
편집: Jan 2018년 6월 8일

0 개 추천

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

Nick George
Nick George 2018년 6월 7일
편집: Nick George 2018년 6월 7일
is this a joke? this is the best solution matlab offers for a very common operation? This answer https://www.mathworks.com/matlabcentral/answers/404380-outer-join-of-multiple-tables is nicer than nesting... but it is still a loop. Both python and r allow passing lists of data frames/tables as an argument to *_join.. I am surprised..
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.
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...

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

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2018년 1월 30일

댓글:

2020년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by