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
Posted 2012年1月22日 GMT-5 14:01 Interfacing, Studies & Solvers Version 4.2a 2 Replies
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.
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 2012年5月9日 GMT-4 18:38