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 Matlab script invoking Matlab external function

Please login with a confirmed email address before reporting spam

Hi everyone,

I hope someone will be able to help me with this. So basically what I am doing is I am using comsol to solve a pde with an external matlab function. When I run my model through the comsol gui, I can invoke this function without any problem and I obtain a fine solution.
The problems comes when I save my model as a .m file and then try to run the matlab generated script through matlab.

Basically, I get the error:
can not start Matlab ()
- Library: /somepath/flmatlab.so


Note that I am running linux, but this shouldn't be a problem. So I think the problem comes because in the matlab generated script, an external matlab function is defined through something similar to: model.func.create('extm1', 'MATLAB');
and when it comes time to call this function, the script tries for some reasons to run another instance of matlab and fails.

I have been able to run Comsol matlab model script through matlab without any problem when I wasn't using any "external matlab" function.


So does anyone know a way to circumvent this problem? I need the matlab generated script because I need more control on what's going in Comsol, namely, I would like to deal with matlab global variables between my matlab function and the matlab workspace.

So how do I tell my script not to try to run another instance of matlab or how do I tell it that it doesn't need to do so in order to call this function?

Thanks for the help.

2 Replies Last Post May 9, 2012, 6:38 p.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 25, 2012, 4:41 p.m. EST
Alright, I feel like an idiot now. I solve my problem by reading through the documentation:
Note this:
To install the missing packages on Debian and Ubuntu, type
sudo apt-get install xterm csh


This is what I was missing. The moral of the story: Read the documentation.
Alright, I feel like an idiot now. I solve my problem by reading through the documentation: Note this: To install the missing packages on Debian and Ubuntu, type sudo apt-get install xterm csh This is what I was missing. The moral of the story: Read the documentation.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 9, 2012, 6:38 p.m. EDT
Great !! i was running into the same problem and found your solution, Thanks !
Great !! i was running into the same problem and found your solution, Thanks !

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.