Finding the index (rank) of a specific number from a column
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Abbi Hashem
le 10 Déc 2018
Commenté : Abbi Hashem
le 10 Déc 2018
Suppose I have a column B = [ 1 4 8 3 5 9]
and I have another vector = [ 8]
In this case, I want to find the rank where it's matched in the vector which should return a value of 3 (3rd). How do I do that ?
3 commentaires
Réponse acceptée
Walter Roberson
le 10 Déc 2018
[~, idx] = ismember(8, B)
3 commentaires
Walter Roberson
le 10 Déc 2018
just_a_variable = 8;
[~, rank_that_you_are_looking_for_this_is_the_result_that_you_want] = ismember(just_a_variable, B);
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!