while loop; a small problem
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear all,
I have the following statement
k=1;
while abs(k) >= 1
'excecute'
end
the above code is included inside a main loop
I observe though that when k=1; is outside the main loop the algorithm does not get stuck. When I include it inside the main loop after some iterations it gets stuck.
Would it be wrong to put it outiside loop?
thanks
답변 (1개)
Matt Fig
2012년 8월 21일
This loop, as you written it, should always 'get stuck' because k does not change inside the loop. What are you trying to do with this loop? Do you just want to print the word execute to the screen once through the outer loop?
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!