MATLAB: How to find the value of a matrix in a specific position

#matrix #position #values

I have a matrix A with the positions (361×2) stored and i want to find the values of another matrix B in the specific positions ..how can i do it?

Best Answer

sz = size( B );
idx = sub2ind( sz, A(:,1), A(:,2) );
res = B( idx );