I have two machines, a client machine and a server machine connected through a network, both with MATLAB installed. For this specific case, the client machine has 64-bit MATLAB 7.13 (R2011b), and the server machine has 32-bit MATLAB 7.12 (R2011a).
I would like to call and utilize the server MATLAB from the client MATLAB using the COM interface (referred to as DCOM when the applications are on remote machines).
How can I do this?
Before setting up communication between 2 MATLAB processes using the DCOM interface, please note that most use cases are much more easily addressed with the regular COM interface, where 2 MATLAB processes running on the same machine communicate with each other.
If running the MATLAB processes on two separate machines is required, follow the instructions below.
It is possible to operate MATLAB through DCOM on a remote machine. To do this, three requirements are necessary:
1. The DCOM security settings must be set appropriately, on both machines. To do this, follow the steps:
a. Open start menu.
b. Search 'dcomcnfg' without hitting enter.
c. Right click on the dcomcnfg result that comes up, and run as administrator. This should open the 'Component Services' window.
d. On the left pane, expand 'Component Services'.
e. Expand 'Computers'.
f. Right click on 'My Computer' and go into 'Properties'.
g. Open 'Default Properties' tab.
h. Ensure 'Enable Distributed COM on this computer' is checked.
i. Ensure 'Default Authentication Level' is 'Connect'.
j. Ensure 'Default Impersonation Level' is 'Identify'.
k. Open 'COM Security' tab.
l. Under 'Access Permissions' section, open 'Edit Defaults...' dialog and ensure administrators have local acess and remote access allowed.
m. Under 'Launch and Activation Permissions' section, open 'Edit Defaults...' dialog and ensure administrators have all permissions allowed.
n. Hit OK on all the dialogs.
o. On the left pane of the 'Component Services' window, expand 'My Computer', then expand 'DCOM Config'.
p. Search for the 'Matlab.Application (Version x.x)', x.x being the version you would like to use (can be different for client and server), right click and open 'Properites'.
q. Under 'General' tab, ensure 'Authentication Level' is 'Default'.
r. Under 'Security' tab, ensure that 'Launch and Activation Permissions' and 'Access Permissions' are set to 'Use Default'.
s. Under 'Identity' tab, set 'The launching user'.
t. Hit OK and close the 'Component Services' window.
Repeat the steps above on both machines.
2. The user needs to be logged into both the client and server machine as themselves, and needs to have Administrator privileges on both machines.
3. The user must have MATLAB licenses under their name on both machines. In other words, the license must be some form of named user license that recognizes the user. As such, trial or designated computer licenses do not work. If you have the license available, but not on the target machine, you can reactivate your MATLAB installation under the appropriate designated user license.
Once the above requirements are met, you can start the server MATLAB from the client MATLAB by inputting the below command in the client:
matlabHandle = actxserver('Matlab.Application.7.12', 'ServerComputerName');
where ServerComputerName is a string representing either the server computer name or IP address. Please note that if you have multiple MATLABs installed on the client machine, the server might pick up any usable MATLAB that satisfies the version information. For example, if you specify the ProgID as 'Matlab.Application', it might pick up any usable MATLAB. If the ProgID is 'Matlab.Application.7.12', it will either pick up the 64-bit or 32-bit version of MATLAB 7.12 (R2011a). There is no specific way to set the architecture that is picked up, beyond uninstalling the extra MATLAB so that only one version exists.
Unlike COM interaction on the local machine, registering a particular MATLAB as an automation server on the client machine has no bearing on DCOM. Note that, also unlike local COM, remote DCOM will not start a visible session on the client machine.
Error using feval
Server Creation Failed: Access is denied.
a. DCOM security settings are incorrect.
b. User does not have administrator privileges on either machine.
Error using feval
Server Creation Failed: Illegal operation attempted on a registry key that has been marked for deletion.
User is not logged into client machine.
Error using feval
Server Creation Failed: Server execution failed
The client MATLAB does not have the right designated user license.