フィルターのクリア

Update table from columns of another table

9 ビュー (過去 30 日間)
Fabio
Fabio 2021 年 12 月 21 日
コメント済み: Fabio 2021 年 12 月 21 日
Hello everyone,
I have two tables, “Atab” and “Btab”, and I would like to update “Atab” by adding all the columns (variables) and their respective values that are in “Btab” but not in “Atab” (meaning columns “Trans” and “Det”).
See in attached “Atab”, “Btab” and the expected “Output” in jpeg files.
Thanks in advance

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 21 日
Avars = A.Properties.VariableNames;
Bvars = B.Properties.VariableNames;
BnotA = setdiff(Bvars, Avars);
Atab = [Atab, B(:,BnotA)];
  3 件のコメント
Walter Roberson
Walter Roberson 2021 年 12 月 21 日
Perhaps you want innerjoin() based upon rowname
Fabio
Fabio 2021 年 12 月 21 日
Yes I would like to innerjoy, but based on the example in the link, I would like that “T” shows as well rows “1” with “Var2” empty and rows “7” and “9” with “Var1” empty.

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

その他の回答 (0 件)

カテゴリ

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