フィルターのクリア

How to use string in if else statement?

66 ビュー (過去 30 日間)
NUR SHOLIHAH RAMLEE
NUR SHOLIHAH RAMLEE 2018 年 6 月 8 日
hi all, i have a code that need me to use the if else statement. in my string, i have two strings of '34970A' and '3458A'. if i am using these two, the code gave me error as : matrix didnt match. how am i going to solve this?
if content_str == '34970A'
content_str = 'Apple';
else if content_str == '03458A'
content_str = 'Grape'
thank you very much for your help :)

採用された回答

KSSV
KSSV 2018 年 6 月 8 日
if strcmp(content_str,'34970A')
content_str = 'Apple';
else if (content_str,'03458A')
content_str = 'Grape'
end
Read about strcmp
  1 件のコメント
NUR SHOLIHAH RAMLEE
NUR SHOLIHAH RAMLEE 2018 年 6 月 8 日
thank you very much. I will read about it :)

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

その他の回答 (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