User`s manual
7 ActiveX and DDE Support
7-10
Additional ActiveX Client Information
Releasing Interfaces
Each ActiveX object can support one or more interfaces. In MATLAB, an 
interface is represented by an instance of the 
activex class. There are three 
ways to get a valid interface object into the MATLAB workspace:
•Return value from 
actxcontrol/actxserver
•Return value from a property via get
•Return value from a method invocation via invoke
In each case, once the interface is represented by an activex object in the 
workspace, it must be released when you are finished using it. Failure to 
release interface handles results in memory and resources being consumed. 
Alternatively, you can use the 
delete command on any valid interface object, 
and all interfaces for that object are automatically released, and thus 
invalidated, and the ActiveX server or control itself is deleted.
MATLAB automatically releases all interfaces for an ActiveX control when the 
figure window that contains that control is deleted or closed. MATLAB also 
automatically releases all handles for an ActiveX automation server when 
MATLAB is shut down.
Using ActiveX Collections
ActiveX collections are a way to support groups of related ActiveX objects that 
can be iterated over. A collection is itself a special interface with a 
Count 
property (read only), which contains the number of items in the collection, and 
an 
Item method, which allows you to retrieve a single item from the collection.
The 
Item method is indexed, which means that it requires an argument that 
specifies which item in the collection is being requested. The data type of the 
index can be any data type that is appropriate for the particular collection and 
is specific to the control or server that supports the collection. Although integer 
indices are common, the index could just as easily be a string value. Often, the 
return value from the 
Item method is itself an interface. Like all interfaces, 
this interface should be released when you are finished with it.
This example iterates through the members of a collection. Each member of the 
collection is itself an interface (called 
Plot and represented by a MATLAB 










