Find Vector of Index Without Using Loop
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
czeslaw
am 27 Apr. 2018
Beantwortet: Akira Agata
am 27 Apr. 2018
Hi all,
If I have
a=[2 3 4 5]
b=[3 5]
%what I want is the index of same elements between a and b, which gives:
i=[2 4]
I want to do this without having to use any loop, because the data is hundreds of thousands elements. Using find() will require me to use loop I think.
Please help. Thanks.
0 Kommentare
Akzeptierte Antwort
Akira Agata
am 27 Apr. 2018
Please try ismember function, like:
[~,idx] = ismember(b,a);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices 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!