Finding matches for a vector

1 回表示 (過去 30 日間)
Jessica Lam
Jessica Lam 2012 年 5 月 23 日
Hi
Instead of using strmatch(), any suggestion for finding matches for a vector? Since one warning is about strmatch() http://www.mathworks.com.au/help/techdoc/ref/strmatch.html (Note strmatch will be removed in a future release), it is better to find sth to replace it.
The following code is the example. Thanks so much! Jessica
signal_vector=[ 1 1 1 1 1 1 0 0 0 0 0 0;5 4 3 2 1 0 0 -1 -2 -3 -4 -5 ]';
a= [1 1];
strmatch(a,signal_vector)
ans =
5
strcmp(a,signal_vector)
ans =
0

採用された回答

Wayne King
Wayne King 2012 年 5 月 23 日
Use ismember
[~,locb] = ismember(a,signal_vector,'rows');
locb is equal to 5
  1 件のコメント
Jessica Lam
Jessica Lam 2012 年 5 月 23 日
thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by