Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Connection between Comsol 4.0 and Matlab R2010a

Please login with a confirmed email address before reporting spam

I have the student license for Comsol 4.0 and i have installed Matlab R2010a. After the installation of Comsol i never got "Matlab with Comsol" icon or anything that indicates connection of these two. I re-installed the Comsol a few times and tried to include everything that indicates this connection but it never works. It has installed "LiveLink" which is supposed to connect Matlab and Comsol but i don`t know how to use LiveLink. When i save Comsol files as .m files and try to run it complaines that it doesn`t recognize the command or class.
What could go wrong?

2 Replies Last Post Aug 22, 2011, 11:09 a.m. EDT
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 7, 2010, 8:17 a.m. EDT
Hi

a) enssure you have 4.0a, latest patch, incl for matlab
b) a .m file saved from Comsol acnnot be opened in the COMSOL GUI V4 environment, you need to open it in matlab, while linked to comsol. Then you might transfer it to COMSOl and save it in a Comsol readable format

I have seen from the Forum that there were some difficulties in the earler V4 releases to link to matlab, there are several entries in the Knowledge Base too about this

--
Good luck
Ivar
Hi a) enssure you have 4.0a, latest patch, incl for matlab b) a .m file saved from Comsol acnnot be opened in the COMSOL GUI V4 environment, you need to open it in matlab, while linked to comsol. Then you might transfer it to COMSOl and save it in a Comsol readable format I have seen from the Forum that there were some difficulties in the earler V4 releases to link to matlab, there are several entries in the Knowledge Base too about this -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 22, 2011, 11:09 a.m. EDT
Hi,
Not sure if you ever solved your problem, but I just saw this and thought I would update this thread for folks with the same problem since I had it as well.

I was running COMSOL 4.2 with LiveLink and Matlab 2010b and they seemed to not know about each other. If you go to page 96 of the COMSOL installation manual (PDF) it shows you how to check the comsol.ini and comsomserver.ini files in your BIN directory. These files must include a line that tells COMSOL where your Matlab directory is stored on your machine. In most cases, you may just have to change this line, but in my case, this line was actually missing completely!

So go to COMSOL -> BIN -> (Platform (eg MACI32/64. or WIN32/64) and edit the comsol.ini and comsolserver.ini using a text editor.

(the following shows the line with a path on a MAC, but the install manual shows examples for Windows as well).

Find the line: -Dcs.mlroot=/Applications/MATLAB_R2010b.app

and be sure this line points to the correct path for your Matlab installation. In my case, this line was completely absent, so I just pasted it in at the end of each file.

Now you should be able to open COMSOL with Matlab and it should automatically start Matlab for you when you do.


I have the student license for Comsol 4.0 and i have installed Matlab R2010a. After the installation of Comsol i never got "Matlab with Comsol" icon or anything that indicates connection of these two. I re-installed the Comsol a few times and tried to include everything that indicates this connection but it never works. It has installed "LiveLink" which is supposed to connect Matlab and Comsol but i don`t know how to use LiveLink. When i save Comsol files as .m files and try to run it complaines that it doesn`t recognize the command or class.
What could go wrong?


Hi, Not sure if you ever solved your problem, but I just saw this and thought I would update this thread for folks with the same problem since I had it as well. I was running COMSOL 4.2 with LiveLink and Matlab 2010b and they seemed to not know about each other. If you go to page 96 of the COMSOL installation manual (PDF) it shows you how to check the comsol.ini and comsomserver.ini files in your BIN directory. These files must include a line that tells COMSOL where your Matlab directory is stored on your machine. In most cases, you may just have to change this line, but in my case, this line was actually missing completely! So go to COMSOL -> BIN -> (Platform (eg MACI32/64. or WIN32/64) and edit the comsol.ini and comsolserver.ini using a text editor. (the following shows the line with a path on a MAC, but the install manual shows examples for Windows as well). Find the line: -Dcs.mlroot=/Applications/MATLAB_R2010b.app and be sure this line points to the correct path for your Matlab installation. In my case, this line was completely absent, so I just pasted it in at the end of each file. Now you should be able to open COMSOL with Matlab and it should automatically start Matlab for you when you do. [QUOTE] I have the student license for Comsol 4.0 and i have installed Matlab R2010a. After the installation of Comsol i never got "Matlab with Comsol" icon or anything that indicates connection of these two. I re-installed the Comsol a few times and tried to include everything that indicates this connection but it never works. It has installed "LiveLink" which is supposed to connect Matlab and Comsol but i don`t know how to use LiveLink. When i save Comsol files as .m files and try to run it complaines that it doesn`t recognize the command or class. What could go wrong? [/QUOTE]

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.