How do I determine if a word has a certain character in it?
For example if I have a word ?????? and want to know if the letter c is in it?

 採用された回答

TastyPastry
TastyPastry 2015 年 11 月 4 日
編集済み: TastyPastry 2015 年 11 月 4 日

0 投票

If you only want to know whether or not the letter is in the word...
hasLetter = any(myWord == 'c');

1 件のコメント

Image Analyst
Image Analyst 2015 年 11 月 5 日
I gave that cell array answer in the duplicate question.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 11 月 4 日

0 投票

How about strfind()
index = strfind(string, 'c');

カテゴリ

ヘルプ センター および File Exchange で Characters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by