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

조회 수: 5 (최근 30일)
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 CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by