This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Remove OPC Toolbox objects from memory




delete(Obj) removes the OPC Toolbox™ object Obj from memory. Obj can be an array of objects. A deleted object becomes invalid and you cannot reconnect it to the server after it has been deleted, so you should remove references to that object from the workspace with the clear command. Deleting an object that contains children (groups or items) also deletes these children, so you should remove references to these children.

If multiple references to a toolbox object exist in the workspace, then deleting one object invalidates the remaining references.

If Obj is an opcda object connected to the server, delete disconnects and deletes the object.


Create an OPC HDA Client, delete the object, and clear the variable from the workspace:

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

Delete a group and its children from memory:

da = opcda('localhost','Matrikon.OPC.Simulation');
grp = addgroup(da,'DeleteEx');
itm = additem(grp,'Random.Real4');
r = read(grp)
delete(grp);    % deletes itm as well
clear grp itm

Introduced before R2006a

Was this topic helpful?