Invalid expression, can anybody help me

x=('heart rate');
switch (x)
case 70
disp('normal')
case 100
disp('HHR')
case 50
disp('LHR')
otherwise
disp('abnormal')
end

댓글 수: 1

The code you show does not throw an error (even if it does not do anything useful):
x=('heart rate');
switch (x)
case 70
disp('normal')
case 100
disp('HHR')
case 50
disp('LHR')
otherwise
disp('abnormal')
end
abnormal

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2022년 12월 20일

0 개 추천

What is the purpose of:
x=('heart rate');
Afterwards x is the CHAR vector 'heart rate' and you compare it to numerical values. Of course no numberical value matchs this char vector.
Please post the complete message, which mentions the failing line also. The readers cannot guess, which expression is invalid.

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

Ali
2022년 12월 20일

답변:

Jan
2022년 12월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by