Main Content

Register MATLAB as COM Server


Instead of writing applications that call MATLAB® as a COM Automation server, consider using the MATLAB Engine API for .NET. For more information, see Call MATLAB from .NET.

When to Register MATLAB

To use MATLAB as a COM server, you must register the application in the Windows® registry. When you install a new version of MATLAB, MATLAB automatically registers this version as a COM server for all users. To see which versions of MATLAB are registered, start MATLAB and type:


MATLAB displays the installation paths to the registered MATLAB versions. The information is specific to your configuration, for example:

         User: 'C:\Program Files\MATLAB\R2020a\bin\win64\MATLAB.exe'
Administrator: 'C:\Program Files\MATLAB\R2019b\bin\win64\MATLAB.exe'

To understand local user accounts and administrative privileges and how Windows selects a COM server based on these values, refer to your Microsoft® Windows documentation.

If the registered version of MATLAB is not your preferred version, then choose one of these techniques:

Register MATLAB for Current User

If you do not have administrator privileges or you start MATLAB without administrator privileges, you can still register MATLAB as a COM server.

Start the version of MATLAB you want to register and use the comserver command:


This command registers MATLAB for your user account only. When you start your COM application without administrative privileges, then the application communicates with this MATLAB version.

To use the MATLAB version that is registered by the administrator, start the MATLAB registered to your user account and use comserver to unregister your version:

         User: ''
Administrator: 'C:\Program Files\MATLAB\R2019b\bin\win64\MATLAB.exe'

Now your application communicates with MATLAB R2019b.


The comserver function is available for MATLAB R2020a and later.

Register MATLAB for All Users

You must have administrator privileges to register MATLAB as a COM server for all users. Based on your User Account Control (UAC) settings, you might need to right-click the Windows Command Prompt or the MATLAB icon and select Run as administrator. If that option is not available, contact your system administrator.

If you have multiple versions of MATLAB installed on your system, only one version is registered as the default for all users. This version of MATLAB remains registered until you install or register a different version of MATLAB.

Start the version of MATLAB you want to register and use the comserver command:



The comserver is available for MATLAB R2020a and later. To register previous versions of MATLAB, call the regmatlabserver function.

Register from Operating System Prompt

To register MATLAB as a COM server from the Windows system prompt, first open a Windows Command Prompt using the Run as administrator option.

Move to the folder containing the executable file for the MATLAB version you want to register using this command:

cd matlabroot\bin\win64

where matlabroot is the full path to the MATLAB installation folder. Call matlabroot in MATLAB to get the value. If you do not use this folder, the matlab command starts the first instance of MATLAB on the system path.

To register MATLAB:

matlab -batch "comserver('register','User', 'all')"

MATLAB displays a minimized command window. Open this window and exit MATLAB.


The comserver is available for MATLAB R2020a and later. To register previous versions of MATLAB, use the matlab -regserver option.

Unregister MATLAB as COM Server

For information about how and when to unregister MATLAB, see comserver.

See Also

| |

Related Topics