The Microsoft® Component Object Model (COM) provides a framework for integrating reusable, binary software components into an application. Because components are implemented with compiled code, the source code can be written in programming languages that support COM. Upgrades to applications are simplified, as components can simply be swapped without the need to recompile the entire application. In addition, a component's location is transparent to the application, so components can be relocated to a separate process or even a remote system without having to modify the application.
Alternatively, consider using the Microsoft .NET Framework.
MATLAB supports COM and the .NET Framework integration on the Microsoft Windows® platform only.
|Create COM server|
|Create Microsoft ActiveX control in figure window|
|List currently installed Microsoft ActiveX controls|
|Create Microsoft ActiveX control from UI|
|List event handler functions associated with COM object events|
|View class methods|
|Associate event handler for COM object event at run time|
|Unregister all event handlers associated with COM object events|
|Unregister event handler associated with COM object event at run time|
|Determine whether input is COM or ActiveX object|
|Determine whether input is COM object event|
|Determine whether input is COM interface|
|Access COM components and ActiveX controls from MATLAB|
This example shows how to write a MATLAB matrix to an Excel® spreadsheet.
For alternatives to importing Excel spreadsheet data into MATLAB, see the functions and examples in Spreadsheets.
This example shows how to change the cursor icon in an Excel® spreadsheet.
This example shows how to change the height of a row, defined by a
Range object, in a spreadsheet.
This example shows how to skip an optional
input argument in the Excel
Add method, used
to insert a sheet into a workbook.
This example shows how to read data from an
weekly_log.xlsx, in MATLAB.
This example shows how to handle a COM interface
event, how to set up an event in a Microsoft
and how to handle its
Learn about a COM object using MATLAB commands
MATLAB includes an example COM control that draws a circle on the screen, displays some text, and fires events when the user single- or double-clicks the control.
This example shows how to call a method of
mwsamp control to redraw a circle.
This example shows how to handle events fired
by the MATLAB ActiveX control,
This example shows how to add a custom property,
This example shows how to consolidate event handlers into a single file using local functions.
This example shows how to restore original
When you deploy a Microsoft ActiveX control that requires a run-time license, include a license key, which the control reads at run time.
This example uses the ActiveX control
which is exposed by the Microsoft Internet
to include an HTML viewer in a MATLAB figure.
COM concepts and an overview of COM support in MATLAB software
Examples that show how to use COM interface with MATLAB software
Before using COM objects, you must register their controls and servers.
How to create Microsoft ActiveX controls and COM server objects
Pass data to and handle data from a COM object
List property names and set values, work with multiple objects and properties, use the Property Inspector, use enumerated values and custom properties
You execute, or invoke, COM functions or methods belonging to COM objects.
Respond to events, write event handlers
For controls, register handler functions either at the time
you create an instance of the control (using
or any time afterward (using
Use these MATLAB functions to save and restore the state of a COM control object.
Use IUnknown, IDispatch, and custom interfaces
COM collections are a way to support groups of related COM objects that can be iterated over.
COM client-server configurations in MATLAB software
Microsoft Forms 2.0 controls are designed for use with applications enabled by Microsoft Visual Basic® for Applications (VBA).
Distributed Component Object Model (DCOM) is a protocol that allows clients to use remote COM objects over a network.
Microsoft does not support loading 32-bit DLLs or in-process COM servers into a 64-bit application, or conversely.
When a MATLAB client sends a command with an invalid argument to a COM server application, the server sends back an error message in the following format.