COM Component Integration
Integrating MATLAB® generated COM components into an application requires you to use a combination of APIs. MATLAB Compiler SDK™ uses APIs to initialize the MATLAB Runtime, load the compiled MATLAB functions into the MATLAB Runtime, and manage data that is passed between the COM components and the MATLAB Runtime. The compiler generates some of the APIs based on the signatures of the compiled functions. MATLAB Runtime provides other APIs that are consistent for all applications.
Use COM components for integrating MATLAB functions into Microsoft® Office products. MATLAB Compiler™ offers direct integration with Microsoft Excel®.
Functions
compiler.build.comComponent | Create COM component for deployment outside MATLAB (Since R2021a) |
compiler.build.COMComponentOptions | Options for building COM components (Since R2021a) |
mcrinstaller | Display version and location information for MATLAB Runtime installer corresponding to current platform |
mcrversion | Return MATLAB Runtime version number that matches MATLAB version |
COM Utility Classes
Examples and How To
- Create a Generic COM Component with MATLAB Code
Learn how to create a generic COM component.
- Register and Reference Utility Library
Register the
MWComUtil
library to use COM components. - Call the Methods of a Class Instance
Call class methods to access the encapsulated MATLAB functions.
- Call COM Objects in Visual C++ Programs
Integrate a COM object into a Visual C++® program.
- Pass Arguments
Pass multiple arguments as a
varargin
array by creating aVariant
array and assigning each array element to the respective input argument. - Control Array Formatting and Data Conversion
Refer to array formatting and data conversion flags.
- Use MATLAB Global Variables in Visual Basic
Class properties allow an object to retain an internal state between method calls.
- Block Execution of Applications That Create Figures
Handle interaction in a console-based program that creates MATLAB figures.
- Obtain Registry Information
Use MATLAB function
componentinfo
to query the system registry for installed COM components. - Integrate Magic Square into a COM Application
Create a COM component from a simple MATLAB file.
- Package COM Components from Command Line
Use
mcc
to build COM components. - Install COM Components
Deploy COM components on target machines.
Concepts
- General Techniques
Integrate COM components into COM compliant programs.
- Handle Errors During a Method Call
Learn how Microsoft Visual Basic® handles exceptions.
- Register COM Component
Register COM components created by MATLAB Compiler SDK on the target machine.
- Data Conversion
Convert data between MATLAB and COM variants.
- Calling Conventions
Learn the method calling conventions for COM components.