Documentation

DataChangeFcn

Callback function file to execute when data change event occurs

Description

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

Description

LocalEventTime

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

TransID

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

GroupName

The group name

Items

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

The Items structure contains the fields defined below.

Field Name

Description

ItemID

The item name

Value

The data value

TimeStamp

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

Characteristics

Access

Read/write

Applies to

dagroup

Data type

string, function handle, or cell array

Values

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

Was this topic helpful?