cancelasync

Cancel asynchronous read and write operations

Syntax

cancelasync(GObj)
cancelasync(GObj,TransID)

Description

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.

Examples

Create a connected client, group, and items:

da = opcda('localhost', 'Matrikon.OPC.Simulation');
connect(da);
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