Finding the indices of the elements of one array in another

1 visualización (últimos 30 días)
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

Respuesta aceptada

Thomas
Thomas el 25 de Sept. de 2012
f=find(ismember(a,b))
output=c(f) % members in c having index of commons in a and b

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by