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

52 次查看(过去 30 天)
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.

回答(2 个)

Stephen23
Stephen23 2018-8-31
for k = 10:-1:0
disp(k)
pause(1)
end

Rehman Tabasum
Rehman Tabasum 2021-4-30
for k = 10:-1:0
disp(k)
pause(1)
end

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by