MATLAB课程:代码示例之Programming(六)
Call COM Objects
Access COM components and ActiveX® controls from MATLAB®
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.
Functionsactxserver | Create COM server |
actxcontrol | Create Microsoft ActiveX control in figure window |
actxcontrollist | List currently installed Microsoft ActiveX controls |
actxcontrolselect | Create Microsoft ActiveX control from UI |
actxGetRunningServer | Handle to running instance of Automation server |
iscom | Determine whether input is COM or ActiveX object |
isprop | Determine whether input is COM object property |
get | Get property value from interface, or display properties |
set | Set object or interface property to specified value |
addproperty | Add custom property to COM object |
deleteproperty | Remove custom property from COM object |
inspect | Open Property Inspector |
propedit | Open built-in property page for control |
fieldnames | Field names of structure, or public fields of object |
ismethod | Determine whether input is COM object method |
methods | Class method names |
methodsview | View class methods |
invoke | Invoke method on COM object or interface, or display methods |
isevent | Determine whether input is COM object event |
events | List of events COM object can trigger |
eventlisteners | List event handler functions associated with COM object events |
registerevent | Associate event handler for COM object event at run time |
unregisterallevents | Unregister all event handlers associated with COM object events at run time |
unregisterevent | Unregister event handler associated with COM object event at run time |
isinterface | Determine whether input is COM interface |
interfaces | List custom interfaces exposed by COM server object |
release | Release COM interface |
Examples and How ToMicrosoft Office Examples- Write Data to Excel Spreadsheet Using ActiveX
- Read Spreadsheet Data Using Excel as Automation Server
- Change Cursor in Spreadsheet
- Change Row Height in Range of Spreadsheet Cells
- Insert Spreadsheet After First Sheet
- Connect to Existing Excel Application
- Display Message for Workbook OnClose Event
- Explore COM Objects
ActiveX Control Examples- MATLAB Sample ActiveX Control mwsamp
- Redraw Circle in mwsamp Control
- Display Event Messages from mwsamp Control
- Add Position Property to mwsamp Control
- Combine Event Handlers as MATLAB Local Functions
- Save mwsamp2 COM Control
- Deploy ActiveX Controls Requiring Run-Time Licenses
Internet Explorer Examples- Use Internet Explorer in MATLAB Figure
Concepts- MATLAB COM Integration
- Getting Started with COM
- Registering Controls and Servers
- Create COM Objects
- Handle COM Data in MATLAB
- COM Object Properties
- COM Methods
- COM Events
- COM Event Handlers
- Save and Delete COM Objects
- COM Object Interfaces
- COM Collections
- Supported Client/Server Configurations
- Microsoft Forms 2.0 Controls
- MATLAB Application as DCOM Client
Troubleshooting- MATLAB COM Support Limitations
- Interpreting Argument Callouts in COM Error Messages
Related Information- Call .NET Libraries
- MATLAB COM Automation Server
- Is it possible to call Excel Macro Functions from MATLAB?