Constructing for loop in terms of seconds

조회 수: 47 (최근 30일)
Yigit
Yigit 2011년 11월 20일
댓글: vcmorini 2017년 4월 22일
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