Manually Create Automation Server
The Microsoft® Windows® operating system automatically creates an Automation server when a client application first establishes a server connection. When the operating system creates a MATLAB® server, this session is different from other MATLAB sessions. The client application communicates with the server session without interfering with any interactive MATLAB sessions that might be running.
Alternatively, you can specify a currently running MATLAB session as the COM server. In this case, your application has access to
data created in the MATLAB session. To create a MATLAB COM server manually, before starting a client process, either call
enableservice from the MATLAB command prompt or start MATLAB with the
-automation switch. Your client application
connects with this running MATLAB.
Create Automation Server at MATLAB Command Prompt
To make MATLAB an Automation server, call the
To determine the current state of a MATLAB Automation server. type:
If MATLAB displays:
ans = 1
then MATLAB is currently an Automation server.
Create Automation Server at Startup
To create a MATLAB server at startup, use the
-automation startup command.
From the operating system prompt, navigate to the installation folder for the specified MATLAB version and type:
-automation Switch to MATLAB Shortcut Icon
To make MATLAB a server every time you run MATLAB, add the
-automation switch to the shortcut
Right-click the MATLAB shortcut icon
and select Properties from the context menu. The Properties dialog box for
matlab.exeopens to the Shortcut tab.
In the Target field, add
-automationto the end of the target path for
matlab.exe. Be sure to include a space between the file name and the hyphen. For example:
"C:\Program Files\MATLAB\R2016a\bin\win64\MATLAB.exe" -automation