How to use string in if else statement?
조회 수: 81 (최근 30일)
이전 댓글 표시
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 :)
댓글 수: 0
채택된 답변
KSSV
2018년 6월 8일
if strcmp(content_str,'34970A')
content_str = 'Apple';
else if (content_str,'03458A')
content_str = 'Grape'
end
Read about strcmp
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!