Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

Additional Automation Server Information

Creating the Server Manually

An Automation server is created automatically by the Microsoft Windows operating system when a controller application first establishes a server connection. Alternatively, you may choose to create the server manually, prior to starting any of the client processes.

To manually create a MATLAB server, use the /Automation switch in the MATLAB startup command. You can do this from the DOS command line by typing:

matlab /Automation

Alternatively, you can add this switch every time you run MATLAB, as follows:

  1. Right-click the MATLAB shortcut icon

    and select Properties from the context menu. The Properties dialog box for matlab.exe opens to the Shortcut tab.

  2. In the Target field, add /Automation to the end of the target path for matlab.exe. Be sure to include a space between the file name and the symbol /. For example:

    "C:\Program Files\MATLAB\R2006a\bin\win32\MATLAB.exe /Automation"

Specifying a Shared or Dedicated Server

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.

Starting a Shared Server

The ProgID, matlab.application, specifies the default mode, which is shared. You can also use the version-specific ProgID, matlab.application.N.M, where N is the major version and M is the minor version of your MATLAB. For example, use N = 7 and M = 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 ProgID, matlab.application.single.N.M).

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.

Using Date Data Type

When you need to pass a VT_DATE type input to a Visual Basic program or an ActiveX control method, you can use the MATLAB class COM.date. For example:

d = COM.date(2005,12,21,15,30,05);
get(d)
     Value: 7.3267e+005
    String: '12/21/2005 3:30:05 PM'

You can use now to set the Value property to a date number:

d.Value = now;

Using MATLAB Application as a DCOM 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, you can use the controller to start a MATLAB server on a remote machine.

To do this, 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 may not be running 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 the DCOM documentation for how to configure DCOM for your environment.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS