MATLAB Answers


Automatically Run a Matlab Script

Asked by Robert Henson on 16 Nov 2017
Latest activity Commented on by Robert Henson on 16 Nov 2017
I have a script that I want to run automatically (say, each hour). How do I set this up so that it runs in an unattended manner?


Sign in to comment.

1 Answer

Answer by Image Analyst
on 16 Nov 2017
 Accepted Answer

Use a timer:
timer class
Create object to schedule execution of MATLAB commandsexpand all in page Description Use a timer object to schedule the execution of MATLAB® commands one or multiple times. If you schedule the timer to execute multiple times, you can define the time between executions and how to handle queuing conflicts.
The timer object uses callback functions to execute commands. Callback functions execute code during some event. For the timer object, you can specify the callback function as a function handle or as a character vector. If the callback function is a character vector, MATLAB evaluates it as executable code. The timer object supports callback functions when a timer starts (StartFcn), executes (TimerFcn), stops (StopFcn), or encounters an error (ErrorFcn).

  1 Comment

Thank you.

Sign in to comment.