Skip to Main Content Skip to Search
Product 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);
get(da, 'Status')

Disconnect from the server:

disconnect(da);
get(da, 'Status')
 

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

hdaObj = opc.hda.Client('localhost', 'Matrikon.OPC.Simulation'); 
connect(hdaObj);

Check the status of the connection:

hdaObj.Status

And disconnect from the server:

disconnect(hdaObj);
hdaObj.Status

See Also

connect | isConnected | propinfo

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS