Comparing Dataset
2 views (last 30 days)
Show older comments
Hi everyone,
I'm a newbie in matlab.
I have two big datasets with different number of row but same number in column. I need to compare each element of both datasets with reference of column #1. If column #1 in both data set has exactly the same value then subtract column 2 in 1st dataset with 2nd dataset.
Let says:
dataset1 = [1 2; 2 2; 3 5; 4 2; 5 10]; dataset2 = [1 4; 3 2; 5 2];
and the result that I want is:
result = [1 -2; 3 3; 5 8]
How can I solve this? Thanks in advance.
0 Comments
Accepted Answer
Walter Roberson
on 9 May 2012
Use the three-output version of ismember to figure out which columns match which.
4 Comments
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays 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!