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.
accessing MATLAB global variables when running models in MATLAB
Posted 22 déc. 2011, 12:59 UTC−5 Interfacing, LiveLink for MATLAB, Materials 4 Replies
Please login with a confirmed email address before reporting spam
Everything works fine with this (comsol passes x,y,z vectors and matlab returns heat source values based on this, and the model is set up and solved)
Now, I tried to use some global MATLAB variables within the 'my_heat' function. When I run function in MATLAB the variables and their values are accessible in 'my_heat'. However, when the same function is called by COMSOL as part of setting the physics, it seems 'my_heat' does not recognize these variables.
I think I know what the problem is, but don't know the solution to it:
When the model is run from Matlab, Comsol seem to open another instance of MATLAB (as manifested by a second command window). This seems like the place where all the Comsol/Matlab interfacing happens. No wonder that in this new instance of Matlab, the information about any global variables in the main Matlab window is missing.
Any ideas on how to 'pass' all the info from the main Matlab window to this auxiliary one?
Thanks,
Robert
P.S.: On an unrelated note, I discovered that by typing 'clear functions' in this new matlab window, I can have comsol get the updated version of any edits to my matlab fuinctions. Without this, comsol only has the first version of external functions. Typing 'clear functrions' in the main matlab window doesn't maker any difference.
Hello Robert Furstenberg
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.