MATLAB COM Automation Server Interface
COM Server Types
Automation — A server that supports the OLE Automation standard. Automation servers are based on the
IDispatchinterface. Clients of all types, including scripting clients, access Automation servers.
Custom — A server that implements an interface directly derived from
IUnknown. MATLAB® does not support custom interfaces.
Dual — A server that implements a combination of Automation and Custom interfaces.
To create an instance of a COM object, use its programmatic identifier, or ProgID. The ProgID is a unique string defined by the component vendor to identify the COM object. You obtain a ProgID from your vendor documentation.
The MATLAB ProgIDs for shared servers are:
Matlab.Application— Starts a command window Automation server with the version of MATLAB that was most recently used as an Automation server (which might not be the latest installed version of MATLAB)
Matlab.Autoserver— Starts a command window Automation server using the most recent version of MATLAB
Matlab.Desktop.Application— Starts the full desktop MATLAB as an Automation server using the most recent version of MATLAB
The ProgIDs for dedicated servers are:
These version-independent MATLAB ProgIDs specify the currently registered version of MATLAB.
To create an instance of a specific registered MATLAB version, you can use a version-dependent ProgID. For
Matlab.Application.7.14 creates an instance of MATLAB version 7.14 (R2012a).
Shared and Dedicated Servers
You can start the MATLAB Automation server in one of two modes – shared or dedicated. A
dedicated server is dedicated to a single client; a shared server is shared by
multiple clients. The mode is determined by the programmatic identifier (ProgID)
used by the client to start MATLAB. If you use
matlab.application as your ProgID, then
MATLAB creates a shared server.
Starting a Shared Server
matlab.application, specifies the default mode,
which is shared. You can also use the version-specific ProgID,
N is the
major version and
M is the minor version of your MATLAB. For example, use
4 for MATLAB version 7.4.
Once MATLAB is started as a shared server, all clients that request a connection to MATLAB using the shared server ProgID connect to the already running instance of MATLAB. In other words, there is never more than one instance of a shared server running, since it is shared by all clients that use the shared server ProgID.
Starting a Dedicated Server
To specify a dedicated server, use the ProgID,
matlab.application.single, (or the version-specific
Each client that requests a connection to MATLAB using a dedicated ProgID creates a separate instance of MATLAB; it also requests the server not be shared with any other client. Therefore, there can be several instances of a dedicated server running simultaneously, since the dedicated server is not shared by multiple clients.
In-Process and Out-of-Process Servers
MATLAB supports these server configurations.
An in-process server is a component implemented as a dynamic link library (DLL) that runs in the same process as the client application, sharing address space. Communication between client and server is relatively fast and simple.
Local Out-of-Process Server
A local out-of-process server is a component implemented as an executable
EXE) file that runs in a separate process from the
client application. The client and server processes are on the same computer
system. This configuration is slower due to the overhead required when
transferring data across process boundaries.
Remote Out-of-Process Server
Distributed Component Object Model (DCOM) is a protocol that allows COM connections to be established over a network. If you are using a version of the Windows® operating system that supports DCOM and a controller that supports DCOM, then you can use the controller to start a MATLAB server on a remote machine. DCOM must be configured properly, and MATLAB must be installed on each machine that is used as a client or server. Even though the client machine might not run MATLAB in such a configuration, the client machine must have a MATLAB installation because certain MATLAB components are required to establish the remote connection. Consult your DCOM documentation for how to configure DCOM for your environment.
Network communications, in addition to the overhead required for data transfer, can make this configuration slower than the local out-of-process configuration.
For more information, see these articles.