Finding indices of multiple items in a matrix?

matlab, matrix, search

Solution

I think you want:

find(ismember(B, A))

ans =

    1    2    3    6    9   10   11

Problem

I have an array of elements and I want to see the indices of them inside another matrix For example, for ``` A = [1 2 3] B = [1 2 3 4 5 3 4 5 1 2 3] ``` then result array ``` C = [1 2 3 6 9 10 11] ``` that give the indices of 1 2 3 Is there any function or a short way to handle?

Original source