Find in Array of Strings

3 ビュー (過去 30 日間)
Sam Da
Sam Da 2011 年 6 月 28 日
how do i find the row number for 'STG' in the following array of names as: 'asf' 'poif' 'STG' 'iam' 'no'

採用された回答

Matt Fig
Matt Fig 2011 年 6 月 28 日
Is your array a cell array or a character array? If it is a cell array,
A = {'asf'
'poif'
'STG'
'iam'
'no'}
strmatch('STG',A)
Or you can use:
find(strcmp(A,'STG'))
  1 件のコメント
Jan
Jan 2011 年 6 月 28 日
I prefer the faster STRCMP method. +1

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by