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.


Cancel asynchronous read and write operations




cancelasync(GObj) cancels all asynchronous read or write operations that are in progress for the group object specified by GObj. Note that this function is asynchronous and does not block the MATLAB® command line.

After cancelasync cancels the in-progress asynchronous operations, the OPC server generates a cancel async event. If you specify a callback function file for the CancelAsyncFcn property, the callback function executes when this event occurs.

cancelasync(GObj,TransID) cancels the asynchronous operation(s), specified by the transaction ID(s) given by TransID. You can cancel specific asynchronous requests using this syntax.


Create a connected client, group, and items:

da = opcda('localhost', 'Matrikon.OPC.Simulation');
grp = addgroup(da, 'CancelAsyncEx');
additem(grp, {'Random.Real8', 'Random.Real4'});

Request an asynchronous read operation and then immediately cancel that request:

tid = readasync(grp); cancelasync(grp, tid)

Introduced before R2006a