how to find the position in a string array

8 vues (au cours des 30 derniers jours)
Shown
Shown le 6 Avr 2014
Commenté : Jan le 6 Avr 2014
attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

Réponse acceptée

Walter Roberson
Walter Roberson le 6 Avr 2014
Read the documentation in ismember()
  2 commentaires
Shown
Shown le 6 Avr 2014
thanks, I got it.
[a,b]=ismember(str,attributes)
b
Jan
Jan le 6 Avr 2014
I'd prefer this instead:
index = find(strcmp(attributes, str))

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by