Esta página es para la versión anterior. La página correspondiente en inglés ha sido eliminada en la versión actual.
Objetos COM enMATLAB
La plataforma Microsoft®Component Object Model(COM) proporciona un marco para integrar componentes de software reutilizables y binarios en una aplicación. Debido a que los componentes se implementan con código compilado, es posible escribir el código fuente en lenguajes de programación que sean compatibles con COM. Las actualizaciones a las aplicaciones se simplifican, ya que los componentes simplemente se pueden intercambiar sin tener que volver a compilar la aplicación completa. Además, la ubicación de un componente es transparente para la aplicación, por lo que los componentes pueden reubicarse en un proceso aparte o incluso en un sistema remoto sin tener que modificar la aplicación.
De manera alternativa, se puede considerar la posibilidad de usar Microsoft .NET Framework.
MATLAB admite la integración de COM y .NET Framework solo en la plataforma de Microsoft Windows®.
Funciones
actxserver |
Create COM server |
actxGetRunningServer |
Handle to running instance of Automation server |
methodsview |
View class methods |
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 |
unregisterevent |
Unregister event handler associated with COM object event at run time |
iscom |
Determine whether input is COM object |
isevent |
Determine whether input is COM object event |
isinterface |
Determine whether input is COM interface |
Objetos
COM |
Access COM components fromMATLAB |
Ejemplos y procedimientos
MicrosoftOffice
- Write Spreadsheet Data Using Excel as Automation Server
This example shows how to write a MATLAB matrix to an Excel®spreadsheet. - Read Spreadsheet Data Using Excel as Automation Server
This example shows how to use a COM Automation server to access another application from MATLAB. - Change Cursor in Spreadsheet
This example shows how to change the cursor icon in an Excel® spreadsheet. - Change Row Height in Range of Spreadsheet Cells
This example shows how to change the height of a row, defined by aRange
object, in a spreadsheet. - Insert Spreadsheet After First Sheet
This example shows how to skip an optional input argument in the ExcelAdd
method, used to insert a sheet into a workbook. - Connect to Existing Excel Application
This example shows how to read data from an open file,weekly_log.xlsx
, in MATLAB. - Display Message for Workbook OnClose Event
This example shows how to handle a COM interface event, how to set up an event in aMicrosoft Excelworkbook
object, and how to handle itsBeforeClose
event. - Explore COM Objects
Learn about a COM object using MATLAB commands.
Conceptos
- MATLAB COM Integration
COM concepts and an overview of COM support in MATLAB.
- Get Started with COM
Examples that show how to use COM interface with MATLAB.
- Register Servers
Before using COM objects, you must register their servers.
- Create COM Objects
How to create Microsoft controls and COM server objects.
- Handle COM Data in MATLAB
Pass data to and handle data from a COM object.
- COM Object Properties
List property names and set values, work with multiple objects and properties, use the Property Inspector, use enumerated values and custom properties.
- COM Methods
You execute, orinvoke, COM functions or methods belonging to COM objects.
- COM Events
Respond to events, write event handlers.
- COM Event Handlers
Use
registerevent
对再保险gister server events. - Save and Delete COM Objects
Use these MATLAB functions to save and restore the state of a COM control object.
- COM Object Interfaces
Use COM interfaces.
- COM Collections
COMcollectionsare a way to support groups of related COM objects that can be iterated over.
- Supported Client/Server Configurations
COM client-server configurations in MATLAB.
- MATLAB Application as DCOM Client
Distributed Component Object Model (DCOM) is a protocol that allows clients to use remote COM objects over a network.
Solución de problemas
MATLAB COM Support Limitations
Microsoft does not support loading 32-bit DLLs or in-process COM servers into a 64-bit application, or conversely.
Interpreting Argument Callouts in COM Error Messages
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.