substitute for do while loop

8 views (last 30 days)
Terry McGinnis
Terry McGinnis on 23 Jun 2015
Commented: Terry McGinnis on 23 Jun 2015
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?

Accepted Answer

Jan
Jan on 23 Jun 2015
doLoop = true;
while doLoop
disp('in loop');
if rand < 0.01 % <- Your control to break the loop
doLoop = false;
end
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!