Related Questions

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How can I find out what the default MATLAB COM Automation Server is when I have different versions installed?

Asked by MathWorks Support Team on 23 Mar 2010
Latest activity Commented on by Madhura Suresh about 22 hours ago

I have multiple versions of MATLAB installed on my system. I would like to interface with MATLAB through the COM Automation Server interface. Is there a way to determine what version is being called by default?


MathWorks Support Team


2 Answers

Answer by MathWorks Support Team on 18 Oct 2013
Accepted answer

The following code will determine what the default server is and if the MATLAB executable that is specified in it exists or not:

function getmatlabdefaultserver()
function getdefaultserver(serverApplication)
if ~exist('serverApplication', 'var')
error('Please specify a server application');
      % Get registry keys.
      serverAppCLSID = winqueryreg('HKEY_CLASSES_ROOT', [serverApplication '\CLSID\']);
      progId = winqueryreg('HKEY_CLASSES_ROOT', ['CLSID\' serverAppCLSID '\']);
      localServer32 = winqueryreg('HKEY_CLASSES_ROOT', ['CLSID\' serverAppCLSID '\LocalServer32\']);
      disp(['The default Automation Server for "' serverApplication '" on this machine is:'])
      disp(['ProgId: ' progId]);
      disp(['LocalServer32: ' localServer32]);
      disp(['CLSID: ' serverAppCLSID]);
      % Parse server application's path.
      serverAppPath = regexpi(localServer32, '.*\.exe', 'match', 'once');
      serverAppPath = strrep(serverAppPath, '"', ''); % Remove ".
      % Check if executable exists.
      if ~isempty(serverAppPath)
          if exist(serverAppPath, 'file')
              disp(['File exists: ''' serverAppPath '''']);
              warning(['File does not exist: ' serverAppPath]);
      disp('There was an error while reading the registry.');

To register a certain MATLAB version as the default server, execute the following command in the MATLAB Command Window of your desired version, as specified in the related solution 1-3ZJXQR:

!matlab -regserver


MathWorks Support Team
Answer by Stev on 15 Dec 2014 at 13:11

Is it possible to have different dcom servers for 2010b and 2010bSP2?

1 Comment

Madhura Suresh about 22 hours ago

Stev, This article is for COM servers, not DCOM servers.


Contact us