how to find the position in a string array

8 ビュー (過去 30 日間)
Shown
Shown 2014 年 4 月 6 日
コメント済み: Jan 2014 年 4 月 6 日
attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

採用された回答

Walter Roberson
Walter Roberson 2014 年 4 月 6 日
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 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by