MATLAB API for COM Automation Server
Automation is a COM protocol that allows one application (thecontrollerorclient) to control objects exported by another application (theserver). MATLAB supports COM Automation server capabilities on Microsoft®Windows®operating systems. Any Windows program that can be configured as an Automation controller can control MATLAB. Some examples areMicrosoft Excel®andMicrosoft Access™, and manyMicrosoft Visual Basic®andMicrosoft Visual C++®programs.
If you build client applications using C/C++, or Fortran, then use MATLAB Engine Applications instead of an Automation server.
Functions
actxGetRunningServer |
Handle to running instance of Automation server |
enableservice |
Enable, disable, or report status of MATLAB Automation server |
Execute |
Execute MATLAB command in Automation server |
Feval |
Evaluate MATLAB function in Automation server |
GetCharArray |
Character array from Automation server |
GetFullMatrix |
Matrix from Automation server workspace |
GetVariable |
自动化的数据变量server workspace |
GetWorkspaceData |
Data from Automation server workspace |
MaximizeCommandWindow |
Open Automation server window |
MinimizeCommandWindow |
Minimize size of Automation server window |
PutCharArray |
Store character array in Automation server |
PutFullMatrix |
Matrix in Automation server workspace |
PutWorkspaceData |
Data in Automation server workspace |
Quit |
Terminate MATLAB Automation server |
regmatlabserver |
Register current MATLAB as Automation server |
Examples and How To
Call MATLAB Function from Visual Basic .NET Client
This example calls a user-defined MATLAB function namedsolve_bvp
from aMicrosoft Visual Basicclient application through a COM interface.
Call MATLAB Function from C# Client
This example shows how to call a user-defined MATLAB function,myfunc
, from a C# application.
Pass Complex Data to MATLAB from C# Client
This example creates complex data in the client C# program and passes it to MATLAB.
View MATLAB Functions from Visual Basic .NET Object Browser
You can find out what methods are available from a MATLAB Automation server using the Object Browser of yourMicrosoft Visual Basicclient application.
Launch MATLAB as Automation Server in Desktop Mode
To launch MATLAB as a COM Automation server in full desktop mode, use the programmatic identifierMatlab.Desktop.Application
.
Manually Create Automation Server
Microsoft Windows operating system automatically creates an Automation server when a controller application first establishes a server connection.
Concepts
Register MATLAB as Automation Server
To use MATLAB as an Automation server, you first must register the application in the Windows registry, which happens when you install a new version of MATLAB.
MATLAB COM Automation Server Interface
How to configure MATLAB software as a COM Automation server
To create a server, you need a programmatic identifier (ProgID) to identify the server.
Connect to Existing MATLAB Server
It is not always necessary to create a new instance of a MATLAB server whenever your application needs some task done in MATLAB.
转换sion of MATLAB Types to COM Types
How MATLAB converts data from MATLAB types to COM types.
转换sion of COM Types to MATLAB Types
How MATLAB converts data from a COM application into MATLAB types.
You can start the MATLAB Automation server in one of two modes – shared or dedicated.
To pass aVT_DATE
type input to a Visual Basic program or an ActiveX®control method, use the MATLAB classCOM.date
.
Data Types For Visual Basic .NET Clients
Data types for arguments and return values of server functions are expressed as Automation data types — language-independent types defined by the Automation protocol.
Use theVisible
property to make MATLAB visible in a server application.
MATLAB Application as DCOM Server
Distributed Component Object Model (DCOM) is a protocol that allows COM connections to be established over a network.
Troubleshooting
Waiting for MATLAB Application to Complete
When you call a MATLAB function from another program, the program might display a timeout message while waiting for the MATLAB function to complete.