MATLAB: I have created a matrix out of another matrix. I now want to find the index values for those specific numbers in the 2nd matrix FROM the 1st matrix. How to go about doing that

indexingMATLABmatrix

matrix_1=[11 50;
12 80;
13 120;
14 140;
15 180;
16 210;
17 250;
18 275;
19 325;
20 400;
19 350;
18 300;
17 240;
16 200;
15 190;
14 150;
13 100;
12 75;
10 25]
matrix_2=[11 50;
20 400;
10 25]
I want to create another matrix that lists the index numbers for matrix 2. So it would look something like idx=[1; 10; 19]

Best Answer

[ex, index] = ismember(matrix_2, matrix_1, 'rows')