Documentation

disconnect

Disconnect OPC Toolbox client from server

Syntax

disconnect(Obj)

Description

disconnect(Obj) disconnects the OPC Toolbox™ client object Obj from the server. Obj can be an array of objects.

If the disconnection from the server was successful, the function sets the Obj property Status value to 'disconnected'. You can reconnect Obj to the server with the connect function.

If Obj is an array of objects and the function cannot disconnect some of the objects from the server, it disconnects the remaining objects in the array and issues a warning. If the function can disconnect none of the objects from their server, it generates an error.

Examples

Create an OPC data access client and connect to the server:

da = opcda('localhost','Matrikon.OPC.Simulation');
connect(da);
da.Status

Disconnect from the server:

disconnect(da);
da.Status

Create an OPC HDA client for the Matrikon™ Simulation Server and connect to the server:

hdaObj = opchda('localhost','Matrikon.OPC.Simulation'); 
connect(hdaObj);

Check the status of the connection:

hdaObj.Status

And disconnect from the server:

disconnect(hdaObj);
hdaObj.Status
Was this topic helpful?