IF Statements - case sensitive
조회 수: 7 (최근 30일)
이전 댓글 표시
I am writing an IF statement. The user is prompt to enter the word "play" to begin, how do I write it so it is not case sensitive. For example they could enter "Play" or pLay" or PLAy" and it would accept the word
댓글 수: 0
답변 (1개)
Chad Greene
2014년 2월 28일
Try the strcmpi function.
댓글 수: 1
Chad Greene
2014년 2월 28일
For example:
user_input = 'plAy';
if strcmpi(user_input,'play')
disp('the user has input the word play')
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!