Given a 2x3 matrix x and a 4x2 matrix y, I\'d like to use each row of y to index into x. If the value in x i
x
y
This can be easily vectorized as follows (see sub2ind):
y = y(x(sub2ind(size(x), y(:,1), y(:,2)))==-1,:);