Specify callback function to execute when predefined time period passes
Note: You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.
A timer event is generated whenever the time specified by the TimerPeriod property passes. This event executes the callback function specified for TimerFcn. Time is measured relative to when the device object starts running.
Some timer events might not be processed if your system is significantly slow or if the TimerPeriod value is too small. The time taken to process an event depends on the sample rate, the performance of your system, and the data itself.
There can only be one timer event waiting in the queue at a given time. The callback function must process all available data to ensure that it keeps up with the inflow of data. Alternatively, you can use the SamplesAcquiredFcn (analog input) or SamplesOutputFcn (analog output) property to process the data when a specified number of samples is acquired or output.
Note: For analog input objects, use the SamplesAvailable property inside a callback function to determine the number of samples available in the queue.
For digital I/O objects, timer events are typically used to update and display the state of the device object.
Timer event information is not stored in the EventLog property. When the callback function is executed, the second argument is a structure containing two fields. The Type field value is set to the string 'Timer', and the event Data field value is given below.
Data Field Value
The absolute time (as a clock vector) the event occurred.
AI, AO, DIO, common to all channels and lines
Read-only when running