While loop stops before meeting conditions
이전 댓글 표시
Hi guys,
I am using a while loop with 3 conditions. Here it is :
while (X<90 && Y<90 && Z<90)
...
Or the program stop when I reach these values :
X = 87.55
Y = 87.58
Z = 93.21
Only one condition is true, so why the program stops ?
Thank you very much for your help !
댓글 수: 3
the cyclist
2020년 4월 6일
편집: the cyclist
2020년 4월 6일
This code
X = 87.55;
Y = 87.58;
Z = 93.21;
while (X<90 && Y<90 && Z<90)
print('got here')
break
end
does not enter the while loop for me. (Does it for you?)
Can you post your actual code that exhibits the error, so we can try?
The only thing I can think of is that maybe you have both lower- and upper-case x,y,z, and you've somehow mixed them up.
Torsten
2020년 4월 6일
As written, the program leaves the while loop if at least one condition is false - and this is the case for Z.
Thibaut
2020년 4월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!