필터 지우기
필터 지우기

how to set time for script to execute a function

조회 수: 2 (최근 30일)
Arun Badigannavar
Arun Badigannavar 2012년 12월 18일
댓글: Walter Roberson 2019년 2월 25일
I want to execute a function after 10 seconds,how will i wrrite that,,,have to write using timer?

채택된 답변

Jan
Jan 2012년 12월 18일
A timer is the best solution:
TimerH = timer('TimerFcn', @yourFunction, 'StartDelay', 10, ...
'ExecutionMode', 'singleShot');
start(TimerH);
Consider, that the timer function needs two inputs:
function yourFunction(TimerH, EventData)
...
  댓글 수: 2
Pranav Mathur
Pranav Mathur 2019년 2월 25일
편집: Pranav Mathur 2019년 2월 25일
Can we use timer without user input? Like if I just want to wait for 10sec after execution of a part of code before it starts to execute the next part.
Walter Roberson
Walter Roberson 2019년 2월 25일
Yes, your yourFunction can ignore the two input parameters (but must have slots for them.)
However if you just want a delay, then use pause()

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 18일
>> help tic
>> help toc

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

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

Community Treasure Hunt

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

Start Hunting!

Translated by