how to find the position in a string array

8 Ansichten (letzte 30 Tage)
Shown
Shown am 6 Apr. 2014
Kommentiert: Jan am 6 Apr. 2014
attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by