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

6 views (last 30 days)
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.

Answers (2)

Peter Perkins
Peter Perkins on 4 Apr 2018
Your question is not really clear to me, but likely you want some combination of setdiff and join. A simple example would help.
  1 Comment
Mohammad Hossain
Mohammad Hossain on 4 Apr 2018
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.

Sign in to comment.


Mohammad Hossain
Mohammad Hossain on 4 Apr 2018
Edited: Mohammad Hossain on 4 Apr 2018
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];

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!