MATLAB Answers

0

how to set time for script to execute a function

Asked by Arun Badigannavar on 18 Dec 2012

I want to execute a function after 10 seconds,how will i wrrite that,,,have to write using timer?

  0 Comments

Tags

No tags are associated with this question.

Products

No products are associated with this question.

2 Answers

Answer by Jan Simon
on 18 Dec 2012
 Accepted answer

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)
...

  0 Comments


Answer by Muruganandham Subramanian on 18 Dec 2012

>> help tic

>> help toc

  0 Comments


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!