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.

Comsol with Livelink

Please login with a confirmed email address before reporting spam

Hey Everyone,

I am new to Comsol and Livelink. I've been going through some of the tutorials here www.uaemex.mx/fciencias/Main/LiveLinkforMATLAB_43b.pdf

However, I'm still confused as to how to run an exported .m comsol file in desktop Matlab (since it never actually runs).

The overall scope of what I am trying to do is to a model simulation in Matlab, and have various parameters controlled via a GUI in Matlab.

5 Replies Last Post 2014年2月20日 GMT-5 12:43

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年2月17日 GMT-5 11:27
Hi,
you need to connect Matlab with a Comsol server first if you want to run exported m-files. In Linux a connected Matlab instance can be started by 'comsol server matlab' (assuming that the system links for Comsol and Matlab are set up properly). If you don't know how to connect, you have a look at section 'Running COMSOL with MATLAB' in the LiveLink user guide.
Best regards,
Eli
Hi, you need to connect Matlab with a Comsol server first if you want to run exported m-files. In Linux a connected Matlab instance can be started by 'comsol server matlab' (assuming that the system links for Comsol and Matlab are set up properly). If you don't know how to connect, you have a look at section 'Running COMSOL with MATLAB' in the LiveLink user guide. Best regards, Eli

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年2月17日 GMT-5 13:08
So essentially, I won't be run it on Matlab Desktop? It will have to be through Comsol with Matlab?
So essentially, I won't be run it on Matlab Desktop? It will have to be through Comsol with Matlab?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年2月17日 GMT-5 14:52
Matlab needs to load some special libraries that come with the LiveLink package and then to connect to a Comsol server. Matlab alone is not capable of using any of the commands listed in the LiveLink user guide or handling a Comsol model in any way. So yes, you can use Matlab in Desktop mode, but you have to connect it a Comsol server. That is actually the default setup for writing Matlab code that controls Comsol via the LiveLink toolbox.
Matlab needs to load some special libraries that come with the LiveLink package and then to connect to a Comsol server. Matlab alone is not capable of using any of the commands listed in the LiveLink user guide or handling a Comsol model in any way. So yes, you can use Matlab in Desktop mode, but you have to connect it a Comsol server. That is actually the default setup for writing Matlab code that controls Comsol via the LiveLink toolbox.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年2月19日 GMT-5 14:24
Thanks for the reply. Is there anyway to create a GUI for example 3 in the following PDF though?
www.uaemex.mx/fciencias/Main/LiveLinkforMATLAB_43b.pdf

I want to be able to modify various parameters in the GUI and be able to change the results in the GUI also.
Thanks for the reply. Is there anyway to create a GUI for example 3 in the following PDF though? http://www.uaemex.mx/fciencias/Main/LiveLinkforMATLAB_43b.pdf I want to be able to modify various parameters in the GUI and be able to change the results in the GUI also.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年2月20日 GMT-5 12:43
I'm not sure which example in the PDF you are referring to. In general it should be possible to control parameters and evaluate results using a MATLAB GUI. But solving often takes some time it makes not much sense to me to do all the things in a GUI window which is open all the time. My typical workflow is as follows: I set up parameters for my model stored in a MATLAB script, then start the run cases on a server. During runtime I log the progress in a textfile. When solving is finished the system sends me an email using sendmail. After that examine the results using some MATLAB scripts. Maybe you can avoid using GUIs in a similar way.
I'm not sure which example in the PDF you are referring to. In general it should be possible to control parameters and evaluate results using a MATLAB GUI. But solving often takes some time it makes not much sense to me to do all the things in a GUI window which is open all the time. My typical workflow is as follows: I set up parameters for my model stored in a MATLAB script, then start the run cases on a server. During runtime I log the progress in a textfile. When solving is finished the system sends me an email using sendmail. After that examine the results using some MATLAB scripts. Maybe you can avoid using GUIs in a similar way.

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.