How to do a while loop

I have to combined a for loop and a while loop

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 20 Jan. 2014

0 Stimmen

test=0;
while test==0
test=input('You are in a while loop. Press 1 to exit the loop and 0 to stay');
%your code
end

3 Kommentare

Riri
Riri am 20 Jan. 2014
It still doesn't work the loop goes on forever and when I press 1 nothing happen where should i write the while before or after the script
Image Analyst
Image Analyst am 20 Jan. 2014
Well, why did you say "You are in a while loop" when you didn't even have any while loops at all. All you had were for loops. So why did you say that?
Riri
Riri am 21 Jan. 2014
Nwm I just firgured it out thank you tho

Diese Frage ist geschlossen.

Gefragt:

am 20 Jan. 2014

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by