how to find the position in a string array

attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

 採用された回答

Walter Roberson
Walter Roberson 2014 年 4 月 6 日

2 投票

Read the documentation in ismember()

2 件のコメント

Shown
Shown 2014 年 4 月 6 日
thanks, I got it.
[a,b]=ismember(str,attributes)
b
Jan
Jan 2014 年 4 月 6 日
I'd prefer this instead:
index = find(strcmp(attributes, str))

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

タグ

質問済み:

2014 年 4 月 6 日

コメント済み:

Jan
2014 年 4 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by