制御構文で文字列の比較ができないのはなぜですか?
이전 댓글 표시
if 文や switch case 文などの制御構文の条件判断部分で文字列の比較をするとエラーとなります。例えば、以下のような記述方法ではエラーとなります。
tmp = input('set "on" or "off" >', 's');
if tmp == 'on'
disp('set as on');
else
disp('set as off');
end
エラーの例:
set "on" or "off" >off
??? エラー ==> eq
行列の次元は同じである必要があります
エラー ==> Untitled at 27
if tmp == 'on'
エラー ==
行列の次元は一致しなければなりません。
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 言語の基礎에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!