Loop with Fixed time
8 次查看(过去 30 天)
显示 更早的评论
How can I make the loop with fixed time?
For example:
for i=1:5
somecode;
end
I want to make every calculation time of the loop is about 1 sec And the total calculation time is about 5 sec
0 个评论
采纳的回答
Azzi Abdelmalek
2013-2-3
for i=1:5
%somecode;
pause(1-tw) % tw is your computing time
end
%to find your computing time use tic and toc
2 个评论
Jan
2013-3-5
编辑:Jan
2013-3-5
The Java sleep() timer is more accurate: see http://undocumentedmatlab.com/blog/pause-for-the-better/. A timer might be even more precise.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!