MATLAB: Data comparision in matlab

finding same data

After using image processing I have a [r c] = [1 7;2 8;3 9;4 10;5 11;6 12]; and [R C] = [2 8;1 6;4 9;3 9;6 12;8 1;0 15];
The answer should be [A B] = [2 8;3 9;6 12] I want to find all that [R C] which are in [r c]…

Best Answer

A = [1 7;2 8;3 9;4 10;5 11;6 12];
B = [2 8;1 6;4 9;3 9;6 12;8 1;0 15];
lia = ismember(A,B,'rows');
Anew = A(lia>0,:);
Anew contains the rows that are common.