Finding the indices of the elements of one array in another

조회 수: 1 (최근 30일)
babak
babak 2012년 9월 25일
i have matrix a:
1
2
3
i have matrix b:
1
2
4
and finally matrix c:
3
5
7
i 'm going to find the indices of common contents of a and b, and create a new matrix with the contents of matrix c that are in the same indices that i found between a and b, in another words 1 and two are the common contents in a and b, their indices are 1 and 2, i'm going to shape a new matrix whit the indices 1 and 2 in from matrix c, which are 3 and 5. i wrote the following code but i can not complete that:
f=find(ismember(a,b)) ind=find(f) i dont know what should i write in next steps

채택된 답변

Thomas
Thomas 2012년 9월 25일
f=find(ismember(a,b))
output=c(f) % members in c having index of commons in a and b

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by