Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Connect to COMSOL through MATLAB on OSX/MAC

Please login with a confirmed email address before reporting spam

Hi,
So I've got this bit of code written in matlab that starts up the Comsol multiphysics server and runs some sims on it or whatever. Anyway, the issue is that this code was written on a windows machine, but I'm running it on a mac and don't have windows available to me at the moment.

In principle, I don't see why it shouldn't be possible to connect to the mphserver with mac, but I am at a total loss with regards to how to actually accomplish that. So, please, I really need some help with this.

Here is the code that starts COMSOL from matlab (written for windows)

PathCOMSOL = 'C:/Program Files/COMSOL/COMSOL51/Multiphysics/';
<Irrelevant code>
% connect MATLAB to COMSOL. The first command below uses the "dos.m"
% function
dos(['"',PathCOMSOL,'bin/win64/comsolmphserver.exe" -graphics &']);
addpath([PathCOMSOL,'mli']);
mphstart


Now what I've gathered is that the dos.m function opens up a cmd window in windows and executes some command, presumably that which runs the mphserver .exe. Obviously, this command doesn't exist in mac, but I don't know what the equivalent command would be in mac.

Furthermore, I don't know what the path should be. I know where my comsol installation is in mac, but I'm not even sure which files I need to actually run to connect to the server through matlab.


So, yeah, I really need to get this figured out and I have no idea what to do. Please don't hesitate to ask me for clarification.

Thanks

1 Reply Last Post Jul 5, 2016, 6:17 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Jul 5, 2016, 6:17 a.m. EDT
Hi

This is the command for starting Comsol Multiphysics Server on Mac:

path = '/Applications/COMSOL52a/Multiphysics/bin/comsol mphserver -graphics &'

You can use the dos command to execute such a command (also on a mac), but if you read the documentation on dos you'll finds that you can use the system or unix function to get the same result.

Note on a mac you don't get a visible windows with the Comsol Multiphysics Server. It runs in the background.

--
Lars Gregersen
Comsol Denmark
Hi This is the command for starting Comsol Multiphysics Server on Mac: path = '/Applications/COMSOL52a/Multiphysics/bin/comsol mphserver -graphics &' You can use the dos command to execute such a command (also on a mac), but if you read the documentation on dos you'll finds that you can use the system or unix function to get the same result. Note on a mac you don't get a visible windows with the Comsol Multiphysics Server. It runs in the background. -- Lars Gregersen Comsol Denmark

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.