How to quickly find the indecies of elements in an array?
Show older comments
Dear All,
I have an array A which contains integers. I have another array B. I want to find out the indecis of B in A.
For example, A = [1 9 2 8 3 7 4 6 5], B = [5 6 7]. The indecis of B in A is [9 8 6].
Thanks.
Benson
Accepted Answer
More Answers (1)
Torsten
on 23 May 2021
0 votes
indices = find(A==B)
2 Comments
Benson Gou
on 23 May 2021
Torsten
on 23 May 2021
Ok, seems a loop is required to find the indices for more than one element using the "find" command.
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!