I know this might easy for you, but I won't to countdown from 10:1:-1 i know to to do this loop. what I don't know is how to pause each number by 1 second
Ältere Kommentare anzeigen
Currently the numbers count down as fast as the computer can run the code. To make it a real countdown, add a pause of 1 second inside the loop, after printing the number. Now when you run the program it should print the same thing as before, but with a one-second delay after every number.
1 Kommentar
Robert U
am 31 Aug. 2018
Hi,
have a look at pause() function in documentation: https://de.mathworks.com/help/matlab/ref/pause.html
Kind regards,
Robert
Antworten (2)
Stephen23
am 31 Aug. 2018
for k = 10:-1:0
disp(k)
pause(1)
end
1 Kommentar
alaeddin ellala
am 31 Aug. 2018
Rehman Tabasum
am 30 Apr. 2021
0 Stimmen
for k = 10:-1:0
disp(k)
pause(1)
end
Kategorien
Mehr zu Numeric Types finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!