I’m trying to find where the elements of an Array{Int64,1} are indexed in another Array{Int64,1}. I’m trying something like the following (but b and a are much longer).
b = [7;3];
a = 1:10;
c = findall((in)(b), a);
c = [3;7]
Is there a way to have this sorted? i.e I want c to be [7;3].
Hi, unfortunately that doesn’t work - i think i wasn’t clear in my example, here’s a better one. a is not in ascending order, it is just an Array of random integers and b has more than 2 elements. See the following example:
a = [3;11;18;7;27;5];
b = [3;5;7];
c = findall((in)(b),a);
c
3-element Array{Int64,1}:
1
4
6
reverse(c)
3-element Array{Int64,1}:
6
4
1