Products & Services Solutions Academia Support User Community Company

Learn more about OPC Toolbox   

Deleting Objects

When you finish using your OPC Toolbox objects, use the delete function to remove them from memory. After deleting them, clear the variables that reference the objects from the MATLAB workspace by using the clear function.

To illustrate the deletion process, this example creates several opcda client objects and then deletes them.

Step 1: Create several clients

This example creates several opcda client objects using fictitious host and server ID properties.

da1 = opcda('Host1','Dummy.Server.1');
da2 = opcda('Host2','Dummy.Server.2');
da3 = opcda('Host3','Dummy.Server.3');

Step 2: Delete clients

Always remove toolbox objects from memory, and the variables that reference them, when you no longer need them.

You can delete toolbox objects using the delete function.

delete(da1)
delete(da2)
delete(da3)

Note that the variables associated with the objects remain in the workspace.

whos
  Name      Size                    Bytes  Class

  da1       1x1                       636  opcda object
  da2       1x1                       636  opcda object
  da3       1x1                       636  opcda object

These variables are not valid OPC Toolbox objects.

isvalid(da1)

ans =
    0

To remove these variables from the workspace, use the clear command.

  


Recommended Products

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

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