MATLAB: FInd vector in matrix

findmatrixvector

Lets assume that I have a matrix A 300×2 with x y coordinates. I want to find how many times a specific [x y] exists in this matrix A. I ve tried this but find can search only single values.
i = find(A == [x y]);
Any idea?????

Best Answer

Another method:
I = sum(A(:, 1) == x & A(:, 2) == y);
EDITED: Buggy multiplication method removed. Thanks Andrei!
This method is about 50 times faster than ISMEMBER(A, b, 'rows').