If x>5 for y seconds, then z
1 view (last 30 days)
Show older comments
How can I write this in Matlab? Thanks.
If x>5 for y seconds, then z
2 Comments
Answers (1)
Image Analyst
on 22 Nov 2022
What's wrong with tic and toc?
startTime = tic;
elapsedTime = toc(startTime);
loopCounter = 1;
while elaspedTime < 5
fprintf('Iteration %d.\n', loopCounter)
pause(0.4); % Waste some time.
elapsedTime = toc(startTime);
end
2 Comments
See Also
Categories
Find more on Number Theory in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!