Setdiff with two datasets, looking at only certain columns
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Managing Data 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!