- #1
amazingzuc
- 1
- 0
Im trying to make a countdown timer for my MATLAB class using the tic and toc functions.
so far this is what I have:
function lab4program1
disp('Welcome to the countdown timer program');
done = false;
tic();
while ~done
time = input('Enter a time (seconds) or negative number to quit:');
****************************
disp(toc);
last_time = toc();
while (true)
elapsed_time = toc()-last_time
last_time = last_time+elapsed_time;
end
if done
disp('BLAST OFF!');
end
end
Can anyone help me with the loop that goes where the asterisks are?
so far this is what I have:
function lab4program1
disp('Welcome to the countdown timer program');
done = false;
tic();
while ~done
time = input('Enter a time (seconds) or negative number to quit:');
****************************
disp(toc);
last_time = toc();
while (true)
elapsed_time = toc()-last_time
last_time = last_time+elapsed_time;
end
if done
disp('BLAST OFF!');
end
end
Can anyone help me with the loop that goes where the asterisks are?