Main Content

cancelasync

(To be removed) Cancel asynchronous read and write operations

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

Description

cancelasync(GObj) cancels all asynchronous read and write operations that are in progress for the group object specified by GObj. 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 operations, specified by the transaction IDs given by TransID. You can cancel specific asynchronous requests using this syntax.

example

Examples

collapse all

Start an asynchronous read and then cancel it.

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);

Version History

Introduced before R2006a

expand all

See Also

Functions