This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Callback function file to execute when data change event occurs


You configure DataChangeFcn to execute a callback function file when a data change event occurs. A data change event occurs for subscribed active items within an active group when the value or quality of the item has changed. The events will happen no faster than the time specified for the UpdateRate property of the group. The DeadbandPercent property is used to determine what percentage change in the value or quality initiates the callback. A data change event is only generated when both the Active and Subscription properties are 'on'.

When a data change event occurs, the function specified in DataChangeFcn is passed two parameters: Obj and EventInfo. Obj is the object associated with the event, and EventInfo is an event structure containing the fields Type and Data. The Type field is set to 'DataChange'. The Data field contains a structure with the fields defined below.

Field Name



The time, as a MATLAB® date vector, that the event occurred


0, or the Refresh transaction ID if the data change event was generated by refresh


The group name


A structure containing information about each item whose value or quality updated

The Items structure contains the fields defined below.

Field Name



The item name


The data value


The time, as a MATLAB date vector, that the server's cache was updated

Data change event information is not stored in the EventLog property




Applies to


Data type

character vector, function handle, or cell array


The default value is an empty matrix ([]).