create a new matrix that extracts the values in matrix A as stipulated in matrix B

1 view (last 30 days)
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!

Accepted Answer

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 5 Dec 2019

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!