How to get row index of certain values in a vector
38 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Daniel
le 28 Déc 2013
Commenté : Image Analyst
le 29 Juil 2018
I am looking for a way to extract the row index of certain values from a vector.
I tried with
[ ~ , index ] = max(obj.GanttM(:,2)==i);
This only gives me one index but the number i appears several times. How can I extract all row indeces with one command?
Thank you.
0 commentaires
Réponse acceptée
Image Analyst
le 28 Déc 2013
Use find() instead:
rows = find(obj.GanttM(:,2)==i);
1 commentaire
Image Analyst
le 29 Juil 2018
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!