substitute for do while loop

3 vues (au cours des 30 derniers jours)
Terry McGinnis
Terry McGinnis le 23 Juin 2015
Commenté : Terry McGinnis le 23 Juin 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?
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 23 Juin 2015
Why do you want to replace the while loop?

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 23 Juin 2015
doLoop = true;
while doLoop
disp('in loop');
if rand < 0.01 % <- Your control to break the loop
doLoop = false;
end
end
  1 commentaire
Terry McGinnis
Terry McGinnis le 23 Juin 2015
thanks.I implemented something similar.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by