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 2015/10/02 5:19 GMT-4
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 2010/12/28 3:34 GMT-5
Did you figure it out?
Did you figure it out?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011/01/04 13:35 GMT-5
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 2011/12/21 6:38 GMT-5

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 2013/04/12 13:07 GMT-4
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 2014/03/10 13:16 GMT-4

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 2014/03/10 13:41 GMT-4
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 2014/03/10 16:01 GMT-4

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 2015/10/02 5:19 GMT-4
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.