Let,
A= [1 2 3 4 6 7 8 9; 10 11 12 13 14 15 16 17; 17 18 19 20 21 22 23 24]B=[9 1; 17 1; 24 2]
I want to create a new set of matrix (say, C and D) consisting all the row values from matrix A based on the condition specified for matrix B:
Let [Row, Column 1] of Matrix B = B (:,1) = has different values;
[Row, Column 2] of Matrix B = B (:,2) = 1 or 2;
Column 2 of Matrix B has the same elements as Column 9 of Matrix A.
if [Row, Column 2] of Matrix B = B (:,2) = 1, then copy the entire row value of Matrix A corresponding to the [Row, Column 1] of Matrix B to a new Matrix C and so on…
and if [Row, Column 2] of Matrix B = B (:,2) = 2, then copy the entire row value of Matrix A corresponding to the [Row, Column 1] of Matrix B to a new Matrix D and so on…
Best Answer