| OPC Toolbox™ | ![]() |
M-file callback function to execute when data change event occurs
You configure DataChangeFcn to execute an M-file callback function 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
Access | Read/write |
Applies to | dagroup |
Data type | string, function handle, or cell array |
Values | The default value is an empty matrix ([]). |
Active, DeadbandPercent, Subscription, UpdateRate
![]() | CanonicalDataType | DataType | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |