Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

readasync

Read data asynchronously from group or items

Syntax

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

Description

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.

Examples

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

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

Perform two asynchronous read operations:

tid1 = readasync(grp)
tid2 = readasync(grp,'device')

Examine the event log:

pause(2)
disp('Event log:')
showopcevents(da)

Introduced before R2006a

Was this topic helpful?