How can I modify table by horizontal row wise from three different tables?

5 ビュー (過去 30 日間)
Mohammad Hossain
Mohammad Hossain 2018 年 4 月 3 日
編集済み: Mohammad Hossain 2018 年 4 月 4 日
There are two tables with three columns. First two columns will be considered as a pair and third column is output. Table 2 is a branch of the main table and Table 1 is coming from different source with different pairs and outputs. Now I'm looking to modify Table 2 where I want to add only uncommon pairs from Table 1 but the output values will be taken from main table depending on the pairs, not from the Table 1. Common pairs and pairs with no output from main table will not be added in the modified table. The size of the all table might vary.

回答 (2 件)

Peter Perkins
Peter Perkins 2018 年 4 月 4 日
Your question is not really clear to me, but likely you want some combination of setdiff and join. A simple example would help.
  1 件のコメント
Mohammad Hossain
Mohammad Hossain 2018 年 4 月 4 日
There are two tables (Table 1 and Table 2), that I found from another program. Now I want to compare between them on the basis of col_1 and col_2 (considered as a pair in row wise) and want to modify Table 2. In the modified Table 2, all the pairs will come from Table 2 with their values (values in 3rd column) and also pairs will come from Table 1, those are not common in Table 2. However, these uncommon pairs will leave their original values in 3rd column but they need to search a new value from Main table. If available, then the pairs with new value will be put in modified Table 2. The size of Table 1 and Table 2 might vary but Main Table size is fixed.

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


Mohammad Hossain
Mohammad Hossain 2018 年 4 月 4 日
編集済み: Mohammad Hossain 2018 年 4 月 4 日
Simple example:
A=[8 3 1; 0 0 0; 7 9 7; 5 5 5; 1 4 5]; D=[5 5 0; 7 9 0];
How can I compare between A and D depending on the first two columns and update the D matrix like,
D_modified=[5 5 5; 7 9 7];

カテゴリ

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