sleep
Pauses the current execution for n seconds.
Syntax
sleep(n)
Inputs
- n
- Any valid scalar.
Example
Simple sleep example:
sleep_total = 0;
disp('Start sleeping...')
while sleep_total < 30
sleep_sec = 10;
sleep(sleep_sec)
sleep_total = sleep_total + sleep_sec;
printf('Slept %d seconds\n', sleep_total)
end
sleep_total = 0
Start sleeping...
Slept 10 seconds
Slept 20 seconds
Slept 30 seconds