substitute for do while loop

조회 수: 5 (최근 30일)
Terry McGinnis
Terry McGinnis 2015년 6월 23일
댓글: Terry McGinnis 2015년 6월 23일
I need to implement and exit controlled loop in matlab.Is there a efficient replacement to the 'do...while' that can be in matlab?Or do we need to use some other logic?
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 23일
Why do you want to replace the while loop?

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

채택된 답변

Jan
Jan 2015년 6월 23일
doLoop = true;
while doLoop
disp('in loop');
if rand < 0.01 % <- Your control to break the loop
doLoop = false;
end
end
  댓글 수: 1
Terry McGinnis
Terry McGinnis 2015년 6월 23일
thanks.I implemented something similar.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by