Is there a function that returns t/f when searching for a string case

1 回表示 (過去 30 日間)
Brian Morrison
Brian Morrison 2015 年 3 月 26 日
コメント済み: Brian Morrison 2015 年 3 月 27 日
say I have the case of:
m={'abc';'efg';hij'}
is there a function that can search for the letter 'i' and return an array stating 1 or 0 for true or false if that letter exists in m?
so the answer that i would be looking for would return as:
ans=
0
0
1
I have an older version of Matlab, R2008a
  1 件のコメント
Stephen23
Stephen23 2015 年 3 月 26 日
What does this have to do with the "case" of a string?

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

採用された回答

Jan
Jan 2015 年 3 月 26 日
found = ~cellfun('isempty', strfind(m, 'i'));
  1 件のコメント
Brian Morrison
Brian Morrison 2015 年 3 月 27 日
simple and easy i like it. just had to write a quick if/else statement to switch the 1's and 0's

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by