Merge more that two tables together

7 ビュー (過去 30 日間)
HabenG
HabenG 2021 年 11 月 4 日
編集済み: HabenG 2021 年 11 月 4 日
Is there a way to merge multiple tables? I am trying to use outerjoin and innejoin functions to merge multiple tables but it does look like thats possible, Is there a way around this?

採用された回答

Dave B
Dave B 2021 年 11 月 4 日
You can nest joins:
outerjoin(t3, outerjoin(t1, t2))
Or in a loop, if you have an array of tables:
tbls={t1 t2 t3 t4};
tjoin=tbls{1};
for i = 2:numel(tbls)
tjoin=outerjoin(tjoin, tbls{i})
end
  1 件のコメント
HabenG
HabenG 2021 年 11 月 4 日
編集済み: HabenG 2021 年 11 月 4 日
Much appreciated!! I added mergekeys to keep one variable constat and it did the trick.
tbls = {T1 T2 T3 T4 T5 T6 T7};
tjoin = tbls{1};
for i = 2:numel(tbls)
tjoin = outerjoin(tjoin, tbls{i},"MergeKeys",true);
end
And if anyone is looking for innerjoin here is a fuction for it....
tjoin_inner = rmmissing(tjoin);

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

その他の回答 (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