Constructing for loop in terms of seconds

41 次查看(过去 30 天)
Hi,
for(10 seconds){
do this }
I would like to construct the following but I couldn't figure out how to input loop parameter in terms of time.
Thanks

采纳的回答

Jan
Jan 2011-11-20
It does not work with a FOR loop, but with WHILE:
t0 = clock;
while etime(clock, t0) < 10
pause(0.05); % Some dummy lines
disp(clock);
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by