External Interfaces Previous page   Next Page

MATLAB Automation Server Support

MATLAB on Microsoft Windows supports COM Automation server capabilities. Automation is a COM protocol that allows one application or component (the controller) to control another application or component (the server). Thus, a MATLAB server can be controlled by any Windows program that can be an Automation controller. Some examples of applications that can be Automation controllers are Microsoft Excel, Microsoft Access, Microsoft Project, and many Visual Basic and Visual C++ programs.

This section explains how to create and connect to an Automation server running MATLAB, how to call functions in the server from either MATLAB M-file or Visual Basic client applications, and how to use properties that affect the server:

Creating the Automation Server

Exactly how you create an Automation server depends on the controller you are using. Consult the documentation for your controller for this information. All controllers require a programmatic identifier (ProgID) to identify the server. The ProgID registered for MATLAB is matlab.application.

If your controller is a MATLAB application, you can create the Automation server using the MATLAB actxserver function:

Usually, the Automation server is automatically created by Windows when the controller first establishes its connection to the server. You may also choose to create the server manually. See Creating the Server Manually.

Shared and Dedicated Servers

You can start a MATLAB Automation server in either of two modes:

If you use matlab.application as your ProgID, MATLAB creates a shared server. See Specifying a Shared or Dedicated Server.

Startup Directory

The Automation server starts up in the \bin\win32 subdirectory of your MATLAB root directory, (the directory returned by the matlabroot function). If this is not your usual MATLAB startup directory, then the newly created server may not have access to files in that directory and also will not run your MATLAB startup file (startup.m) when the server process starts MATLAB.

To give the server access to files in your startup directory, you need to either have the server set its working directory to the startup directory (using the cd function), add the startup directory to the server's MATLAB path (using addpath), or include the pathname to the startup directory when referencing those files.


Previous page  Using MATLAB as a DCOM Client Connecting to an Existing Server Next page

© 1994-2005 The MathWorks, Inc.