Setdiff with two datasets, looking at only certain columns
古いコメントを表示
I have two datasets, they have the same column headings and different number of rows. I want to create a new dataset that pulls out what they have in common (intersect) and also what is unique in one versus the other (setdiff).
I would use what I have written above, except that I want to focus in on two columns and pull out the entire row of data.
*Dataset 1:*
Name Position Letter
1 587 A
1 848 A
5 398 B
*Dataset 2:*
Name Position Letter
1 587 B
1 848 C
2 3188 B
8 3282 G
I want to generate a new dataset that looks only at the first and second column to generate new datasets.
For example I want to generate the following if I am looking for "unique" rows present in dataset 1, but not dataset 2:
Dataset 3:
Name Position Letter
5 398 B
Whereas I would generate the following if I am looking for common rows present in dataset 1 that are also in dataset 2:
Dataset 4
Name Position Letter
1 587 A
1 848 A
Even suggestions for commands to look at would be appreciated. Thanks in advance.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Managing Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!