tic while(toc<60) % code end
How I can create a while cycle that ends after a sepecific time
3 views (last 30 days)
Show older comments
Dario Furnari on 3 Jan 2023
Answered: Eric Sofen on 4 Jan 2023
my aim is make a wile cilce that run for a specific time T. For exemple
%where t start from zero and go on whit the time
%t is 1 after 1 second
More Answers (1)
Eric Sofen on 4 Jan 2023
I think timer is likely to give you better precision for this sort of thing than tic/toc (tic/toc is better for timing performance of a function or script). The reference page for timer illustrates exactly this while-loop scenario.
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!