MATLAB: How to compare two sets of XY data

compare data

I have two sets of XY coordinate data. I would like to compare these two sets and count how many same XY coordinate?
For example
A=
(1 2)
(3 5)
(4 6)
B=
(3 4)
(4 6)
(1 1)
(7 8)
result should be count same coordinate= 1 ( that's (4 6))

Best Answer

C = intersect(A,B,'rows')
numberCommonRows = size(C,1);
You can also call intersect() with additional output arguments, which will identify which rows of A and B are the shared ones.
Related Question