How to quickly find the indecies of elements in an array?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Benson Gou
am 23 Mai 2021
Kommentiert: Torsten
am 23 Mai 2021
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
0 Kommentare
Akzeptierte Antwort
per isakson
am 23 Mai 2021
Bearbeitet: per isakson
am 23 Mai 2021
A = [1 9 2 8 3 7 4 6 5];
B = [5 6 7];
[~,ix] = ismember( B, A )
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!