I am completing a project for a class, and one of the tasks is to get an input from a user, and if a specific input is not given, to keep asking until the user types in the correct input. However, my while loop doesn't terminate even after I give the correct input. Can someone help?

답변 (1개)

Matt J
Matt J 2022년 4월 18일
편집: Matt J 2022년 4월 18일

0 개 추천

The termination condition of the while loop depends on windowLength, but nothing inside the while loop makes any modifications to windowLength. Possibly you meant to have,
windowLength=input('....')

댓글 수: 4

Kashish Kashish
Kashish Kashish 2022년 4월 18일
Oh I just realized that, thank you! Turned out to be a simple fix.
Matt J
Matt J 2022년 4월 18일
You're welcome, but please Accept-click to indicate that the answer is applicable to your question.
Image Analyst
Image Analyst 2022년 4월 18일
@Kashish Kashish Please click the "Accept this answer" link to award Matt "Reputation Points".
Hey @Matt J did you also get a copy of the Mind Reading Toolbox? Or has the question been changed since you answered?
Matt J
Matt J 2022년 4월 18일
@Image Analyst The OP removed a screenshot of the code. Hopefully, he will restore it.

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

카테고리

도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2022년 4월 18일

댓글:

2022년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by