Find Vector of Index Without Using Loop
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
czeslaw
le 27 Avr 2018
Réponse apportée : Akira Agata
le 27 Avr 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 commentaires
Réponse acceptée
Akira Agata
le 27 Avr 2018
Please try ismember function, like:
[~,idx] = ismember(b,a);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!