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.


Read data asynchronously from group or items


TransID = readasync(GObj)
TransID = readasync(IObj)


TransID = readasync(GObj) and TransID = readasync(IObj) asynchronously read data for all the items contained in the dagroup object, GObj, or for the vector of daitem objects specified by IObj. TransID is a unique transaction ID for the asynchronous request.

For asynchronous reads, data is always read from the device, not from the server cache. The Active property is ignored for asynchronous reads.

When the read operation completes, a read async event is generated by the server. If a callback function file is specified for the ReadAsyncFcn property, that function executes when the event is generated.

You can cancel an in-progress asynchronous request using cancelasync.

When a readasync operation succeeds, the Value, Quality, and TimeStamp properties of the associated items are updated to reflect the values obtained from the read operation.


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

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

Perform two asynchronous read operations:

tid1 = readasync(grp)
tid2 = readasync(grp)

Examine the event log:

disp('Event log:')

Introduced before R2006a