フィルターのクリア

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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by