This is machine translation

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

Save and Delete COM Objects

Functions for Saving and Restoring COM Objects

Use these MATLAB® functions to save and restore the state of a COM control object.



Load and initialize a COM control object from a file


Write and serialize a COM control object to a file

Save, or serialize, the current state of a COM control to a file using the save function. Serialization is the process of saving an object onto a storage medium (such as a file or a memory buffer) or transmitting it across a network connection link in binary form.

    Note:   MATLAB supports the COM save and load functions for controls only.

Releasing COM Interfaces and Objects

Use these MATLAB functions to release or delete a COM object or interface.



Delete a COM object or interface


Release a COM interface

When you no longer need an interface, use the release function to release the interface and reclaim the memory used by it. When you no longer need a control or server, use the delete function to delete it. Alternatively, you can use the delete function to both release all interfaces for the object and delete the server or control.

    Note:   In versions of MATLAB earlier than 6.5, failure to explicitly release interface handles or delete the control or server often results in a memory leak. This is true even if the variable representing the interface or COM object has been reassigned. In MATLAB version 6.5 and later, the control or server, along with all interfaces to it, is destroyed on reassignment of the variable or when the variable representing a COM object or interface goes out of scope.

When you delete or close a figure window containing a control, MATLAB automatically releases all interfaces for the control. MATLAB also automatically releases all handles for an Automation server when you exit the program.

Related Examples

Was this topic helpful?