필터 지우기
필터 지우기

How to use string in if else statement?

조회 수: 103 (최근 30일)
NUR SHOLIHAH RAMLEE
NUR SHOLIHAH RAMLEE 2018년 6월 8일
댓글: 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 CenterFile 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