External Interfaces/API    

Creating and Executing Action Functions

You can specify the action function to be executed when a specific event type occurs by including the name of the M-file as the value for the associated action property. For example, to execute the action function myaction every time the terminator is read from your device

M-file action functions require at least two input arguments. The first argument is the serial port object. The second argument is a variable that captures the event information given in Table 8-10, Event Information,. This event information pertains only to the event that caused the action function to execute. The function header for myaction is shown below.

You can pass additional parameters to the action function by including them as elements of a cell array. For example, to pass the MATLAB variable time to myaction

The corresponding function header is

If you pass additional parameters to the action function, then they must be included in the function header after the two required arguments.


 Storing Event Information Enabling Action Functions After They Error