From: Ross Anderson on
I ran profiler on my code, and ismember is the culprit. In most cases, I simply need an index for a vector:
if
A = [0 1; 4 5; 6 7];
and
B = [4 5];
then
[~, index] = ismember(B,A,'rows')
yields index = 2, which is all I need (the first return value is always true, no checking needed). But this is slow. Can anyone think of an alternative way of doing this?
From: Matt Fig on
This should be faster:

find(A(:,1)==B(1) & A(:,2)==B(2),1,'last')