Tic and Toc question

조회 수: 13 (최근 30일)
Jason
Jason 2011년 8월 10일
Hi everyone, I just have a quick question. How would I numerate my tic and toc so that I can make my program stop after a certain amount of time? I'm trying to say like, while tic<1 (second), continue, but I am most likely doing it wrong. Can anyone help?

채택된 답변

Daniel Shub
Daniel Shub 2011년 8월 10일
You are close ...
tic
while toc < 1
%do something
end

추가 답변 (1개)

Paulo Silva
Paulo Silva 2011년 8월 10일
tStart = tic;
for n=1:2000
n
if toc(tStart)>=0.1 %100 miliseconds
disp('time exceeded')
break %if it's a function use return
end
end

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by