While Loop Question - Will not properly execute

Can anyone help me out on why this while loop will not execute properly when ran through Matlab?
% Until good height, prompt user to enter a value for height in inches
inches = input ('Enter height in inches(59-78): ');
while (inches <= 59) && (inches >= 78)
disp('not between 59-78');
inches = input('Enter height in inches(59-78): ');
end

 채택된 답변

Geoff Hayes
Geoff Hayes 2019년 2월 13일
편집: Geoff Hayes 2019년 2월 13일

1 개 추천

Josh - you probably want to use OR instead of AND
while (inches < 59) || (inches > 78)
Note also how we use < and > since 59 and 78 are valid inputs.

추가 답변 (0개)

카테고리

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

제품

릴리스

R2018a

태그

질문:

2019년 2월 13일

댓글:

2019년 2월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by