필터 지우기
필터 지우기

how to find the index value

조회 수: 9 (최근 30일)
singh
singh 2015년 5월 13일
편집: James Tursa 2015년 5월 13일
suppose i have on matrix A
A= 2
3
5
7
8
10
i have another matrix B
B=
10 21
20 11
63 43
23 12
32 54
78 45
now i wish to get the value from A 7 and B 23 12 through index value.
suppose 7 value store in A 4 location now i get the 4 location values from B

채택된 답변

James Tursa
James Tursa 2015년 5월 13일
편집: James Tursa 2015년 5월 13일
If you are given the value 7 and want to find it in A and then get the corresponding row in B, then you could do this:
x = find(A==7);
r = B(x,:);
If you don't care about storing the index itself, then you can just use logical indexing directly:
r = B(A==7,:);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by