When you finish using your OPC Data Access 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
When you delete an
opcda client object, all the group and item
objects associated with the
opcda client object are also deleted.
Similarly, when you delete a
dagroup object, all
daitem objects associated with that
To illustrate the deletion process, this example creates several
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(da1) delete(da2) delete(da3)
Note that the variables associated with the objects remain in the workspace.
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 Data Access objects.
ans = 0
To remove these variables from the workspace, use the
You can delete toolbox object vectors using the
You can also delete individual elements of a toolbox object vector.