MATLAB: Create a new matrix that extracts the values in matrix A as stipulated in matrix B

matrixmatrix arraymatrix manipulation

Hello all,
I have a matrix A = [4; 8; 12; 16] where each row refers to a row in another matrix. For instance the other matrix is B = [12; 22; 7;45; 8; 52;48; 55; 34; 2; 14; 33; 2; 78; 14; 10; 18] and A(4,1) refers to the value 45 in B as it is the 4th value in the column.
My question is how can I create a new matrix that extracts the values in B as stipulated in A. For instance using the example above C = [45; 55;33;10].
Any suggestions would be very welcome!

Best Answer

C=B(A);