Calling MATLAB as COM Automation Server

Write COM applications to work with MATLAB®

Automation is a COM protocol that allows one application (the controller or client) to control objects exported by another application (the server). 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 are Microsoft Excel® and Microsoft Access™, and many Microsoft Visual Basic® and Microsoft Visual C++® programs.

If you build client applications using C/C++, or Fortran, then use MATLAB Engine Applications instead of an Automation server.


expand all

regmatlabserverRegister current MATLAB as Automation server
enableserviceEnable, disable, or report status of MATLAB Automation server
actxGetRunningServerHandle to running instance of MATLAB Automation server
ExecuteExecute MATLAB command in Automation server
FevalExecute MATLAB function in Automation server
GetFullMatrixMatrix from Automation server workspace
PutFullMatrixMatrix in Automation server workspace
GetCharArrayCharacter array from Automation server
PutCharArrayCharacter array in Automation server
GetVariableData from variable in Automation server workspace
GetWorkspaceDataData from Automation server workspace
PutWorkspaceDataData in Automation server workspace
MaximizeCommandWindowOpen Automation server window
MinimizeCommandWindowMinimize size of Automation server window
QuitTerminate MATLAB Automation server



Register MATLAB as Automation Server

To use MATLAB as an Automation server, register the application in the Windows registry.

Create MATLAB Server

To create a server, use a programmatic identifier (ProgID) to identify the server.

Manually Create Automation Server

To create a MATLAB server manually, use the -automation switch in the matlab startup command.

Start MATLAB as Automation Server in Desktop Mode

To start MATLAB as a COM Automation server in full desktop mode, use the programmatic identifier Matlab.Desktop.Application.

Connect to Existing MATLAB Server

It is not always necessary to create a new instance of a MATLAB server.

Visible Property

Use the Visible property to make MATLAB visible in a server application.

MATLAB COM Automation Server Interface

Automation Server concepts.

Call MATLAB from COM Application

Call MATLAB Function from C# Client

This example shows how to call a user-defined MATLAB function from a C# application.

Call MATLAB Function from Visual Basic .NET Client

This example calls MATLAB functions from a Microsoft Visual Basic client application.

View MATLAB Functions from Visual Basic .NET Object Browser

Use Microsoft Visual Basic Object Browser to display methods available from a MATLAB Automation server.

Pass Data

Conversion of MATLAB Types to COM Types

How MATLAB converts data from MATLAB types to COM types.

Conversion of COM Types to MATLAB Types

How MATLAB converts data from a COM application into MATLAB types.

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.

Pass Complex Data to MATLAB from C# Client

This example creates complex data in the client C# program and passes it to MATLAB.

VT_DATE Data Type

To pass a VT_DATE type input to a Visual Basic program, use the MATLAB class


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.

Related Information