How to compare two sets of XY 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))

 Accepted 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.

More Answers (0)

Categories

Find more on MATLAB 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!