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.

Evaluate parameter value in MATLAB

Please login with a confirmed email address before reporting spam

Hi,

If I have a parameter, e.g.:

>> model.param.set('outer_z', '((volume*formfactor^2)/(2*pi))^(1/3)');

How can I in the easiest way evaluate the value of this parameter (like the 'Value'-column in the GUI)?

I get an error message when trying to use:
>> mphglobal(model,'outer_z')
"com.comsol.util.exceptions.FlException: Unknown dataset feature"

Regards,
Johan

8 Replies Last Post Oct 2, 2015, 5:19 a.m. EDT
COMSOL Moderator

Hello Johan Gustafsson

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.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 28, 2010, 3:34 a.m. EST
Did you figure it out?
Did you figure it out?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 4, 2011, 1:35 p.m. EST
No, unfortunately I have not. I worked around the problem by calculating the variables in MATLAB first and then assigning the final value to the COMSOL model. But it would still be nice to be able to get this to work.

Johan
No, unfortunately I have not. I worked around the problem by calculating the variables in MATLAB first and then assigning the final value to the COMSOL model. But it would still be nice to be able to get this to work. Johan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 21, 2011, 6:38 a.m. EST

Hi,

If I have a parameter, e.g.:

>> model.param.set('outer_z', '((volume*formfactor^2)/(2*pi))^(1/3)');

How can I in the easiest way evaluate the value of this parameter (like the 'Value'-column in the GUI)?

I get an error message when trying to use:
>> mphglobal(model,'outer_z')
"com.comsol.util.exceptions.FlException: Unknown dataset feature"

Regards,
Johan


The function mphglobal(model,'parameter_name') works for me when calculating parameter values. Maybe there is a problem in your definition of ((volume*formfactor^2)/(2*pi))^(1/3), check that all the parameters are set.

Bye.
[QUOTE] Hi, If I have a parameter, e.g.: >> model.param.set('outer_z', '((volume*formfactor^2)/(2*pi))^(1/3)'); How can I in the easiest way evaluate the value of this parameter (like the 'Value'-column in the GUI)? I get an error message when trying to use: >> mphglobal(model,'outer_z') "com.comsol.util.exceptions.FlException: Unknown dataset feature" Regards, Johan [/QUOTE] The function mphglobal(model,'parameter_name') works for me when calculating parameter values. Maybe there is a problem in your definition of ((volume*formfactor^2)/(2*pi))^(1/3), check that all the parameters are set. Bye.

Andrew Prudil Nuclear Materials

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 12, 2013, 1:07 p.m. EDT
Hi everyone,
Sorry for bring back such an old discussion but I'm having the same problem (unknown data set). I think this problem somehow relates to having not initialized the model (but I'm not sure how). Since it cannot find a dataset to evaluate the string in. Anyone know what I'm missing? Consider the simple striped down MATLAB script below which returns the same error. Interestingly enough model.param.get('test_param_a') will return the original string.

Thanks in advance,
Andrew


import com.comsol.model.*
import com.comsol.model.util.*

model = ModelUtil.create('Model');
model.modelPath('F:\FAST\MATLAB');
model.modelNode.create('mod1');

model.geom.create('geom1', 2);
model.geom('geom1').axisymmetric(true);

model.mesh.create('mesh1', 'geom1');

model.param.set('test_param_a', '1[mm]');

temp = mphglobal(model,'test_param_a')
Hi everyone, Sorry for bring back such an old discussion but I'm having the same problem (unknown data set). I think this problem somehow relates to having not initialized the model (but I'm not sure how). Since it cannot find a dataset to evaluate the string in. Anyone know what I'm missing? Consider the simple striped down MATLAB script below which returns the same error. Interestingly enough model.param.get('test_param_a') will return the original string. Thanks in advance, Andrew import com.comsol.model.* import com.comsol.model.util.* model = ModelUtil.create('Model'); model.modelPath('F:\FAST\MATLAB'); model.modelNode.create('mod1'); model.geom.create('geom1', 2); model.geom('geom1').axisymmetric(true); model.mesh.create('mesh1', 'geom1'); model.param.set('test_param_a', '1[mm]'); temp = mphglobal(model,'test_param_a')

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 10, 2014, 1:16 p.m. EDT

Hi,

If I have a parameter, e.g.:

>> model.param.set('outer_z', '((volume*formfactor^2)/(2*pi))^(1/3)');

How can I in the easiest way evaluate the value of this parameter (like the 'Value'-column in the GUI)?

I get an error message when trying to use:
>> mphglobal(model,'outer_z')
"com.comsol.util.exceptions.FlException: Unknown dataset feature"

Regards,
Johan


I'm also having the same problem, has anyone figured this out?

Thanks,
Mark
[QUOTE] Hi, If I have a parameter, e.g.: >> model.param.set('outer_z', '((volume*formfactor^2)/(2*pi))^(1/3)'); How can I in the easiest way evaluate the value of this parameter (like the 'Value'-column in the GUI)? I get an error message when trying to use: >> mphglobal(model,'outer_z') "com.comsol.util.exceptions.FlException: Unknown dataset feature" Regards, Johan [/QUOTE] I'm also having the same problem, has anyone figured this out? Thanks, Mark

Andrew Prudil Nuclear Materials

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 10, 2014, 1:41 p.m. EDT
It has been a while since I worked with the LiveLink for Matlab. To get a parameter (pellet_length) from Comsol to Matlab I used the following commmand:

pellet_length = mphevalglobalmatrix(model,'pellet_length');

Not sure if this applies only to parameters, or if there is a better way of doing this, but it worked for me.
It has been a while since I worked with the LiveLink for Matlab. To get a parameter (pellet_length) from Comsol to Matlab I used the following commmand: pellet_length = mphevalglobalmatrix(model,'pellet_length'); Not sure if this applies only to parameters, or if there is a better way of doing this, but it worked for me.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 10, 2014, 4:01 p.m. EDT

It has been a while since I worked with the LiveLink for Matlab. To get a parameter (pellet_length) from Comsol to Matlab I used the following commmand:

pellet_length = mphevalglobalmatrix(model,'pellet_length');

Not sure if this applies only to parameters, or if there is a better way of doing this, but it worked for me.


Andrew. Thanks a lot! It turns out that I was able to get
mphglobal(model,'outer_z')
to work too. So it appears I'm in good shape now.

Thanks!
Mark

[QUOTE] It has been a while since I worked with the LiveLink for Matlab. To get a parameter (pellet_length) from Comsol to Matlab I used the following commmand: pellet_length = mphevalglobalmatrix(model,'pellet_length'); Not sure if this applies only to parameters, or if there is a better way of doing this, but it worked for me. [/QUOTE] Andrew. Thanks a lot! It turns out that I was able to get mphglobal(model,'outer_z') to work too. So it appears I'm in good shape now. Thanks! Mark

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Oct 2, 2015, 5:19 a.m. EDT
model.param.get('outer_z') should work
model.param.get('outer_z') should work

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.