Main Content


(To be removed) Read all active items in group

Support for the OPC Data Access (DA) standard will be removed in a future release. Instead use OPC Unified Architecture (UA). See Compatibility Considerations.




refresh(GObj) asynchronously reads data for all active items contained in the dagroup object specified by GObj. Items whose Active property is set to 'off' will not be read. GObj can be an array of group objects. The data is read from the OPC server's cache. You can use refresh only if the Active property is set to 'on' for GObj.

When the refresh operation completes, a DataChange event is generated by the server. If a callback function file is specified for the DataChangeFcn property, then the function executes when the event is generated.

refresh is a special case of subscription that forces a DataChange event for all active items even if the data has not changed. Note that refresh ignores the Subscription property.

refresh(GObj,'Source') asynchronously reads data from the source specified by 'Source', which can be 'cache' or 'device'. If 'Source' is 'device', data is returned directly from the device. If 'Source' is 'cache', data is returned from the OPC server’s cache. Note that reading data from the device can be slow.


Configure a client, group, and item, for the Matrikon™ Simulation Server.

da = opcda('localhost','Matrikon.OPC.Simulation');
grp = addgroup(da,'ExRefresh');
itm = additem(grp,'Random.Real8');

Turn off subscription for the group and add a DataChangeFcn callback.

grp.Subscription = 'off';
grp.DataChangeFcn = 'disp(grp.Item)'

Call refresh to get group and item updates.


Version History

Introduced before R2006a

expand all

See Also