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 would I go about doing that?

1 次查看(过去 30 天)
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]

采纳的回答

Jan
Jan 2019-1-22
[ex, index] = ismember(matrix_2, matrix_1, 'rows')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by