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.

mpheval(..) usage for 1D-Data

Please login with a confirmed email address before reporting spam

Dear Concerned,
I am new to COMSOL live link. I have a working model in COMSOL and the model's output is 1D which is voltage. I have no problems in plotting the data in matlab using model.mphplot('pg1'). Further i do not have problems in plotting the data in COMSOL using 1-D plot group. However when i try to export the data to matlab workspace using
data = mpheval(model,'pg1'), I get the below error:

Undefined variable.
- Variable: pg1
- Geometry: geom1
- Domain: 3
Failed to evaluate expression.
- Expression: real(pg1)

I found similar usage of the functions in the examples and the data is loaded in the workspace as structures without any problem(3D data). However it does not work with simple 1D data. I tried out many combinations of parameters and nothing works out.

Kindly help me with some simple example on the usage.

Thank you.
yours sincerely,
Chris





2 Replies Last Post 09.09.2015, 01:43 GMT-4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 08.09.2015, 03:03 GMT-4
Hi

mpheval works also for 1D models (as well as 2D and 3D models).

You may be using it wrong. I assume that 'pg1' is the tag for your plot group. That is not what mpheval expects. mpheval takes variable names as arguments. E.g.

pd = mpheval(model, 'T')

that works if you have T as a variable in your model.

If you wish to extract data from a plot you can do:

pd = mphplot(model, 'pg1')

and look through the pd-data that are returned.


--
Lars Gregersen
Comsol Denmark
Hi mpheval works also for 1D models (as well as 2D and 3D models). You may be using it wrong. I assume that 'pg1' is the tag for your plot group. That is not what mpheval expects. mpheval takes variable names as arguments. E.g. pd = mpheval(model, 'T') that works if you have T as a variable in your model. If you wish to extract data from a plot you can do: pd = mphplot(model, 'pg1') and look through the pd-data that are returned. -- Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 09.09.2015, 01:43 GMT-4
Thanks a lot Mr.Lars.

Yes i was using it wrong and that was really silly by me to use the tag as you have pointed out. Little bit carried away by the error message( - Domain: 3) . Thank you, it works fine now.

yours sincerely,
Christober
Thanks a lot Mr.Lars. Yes i was using it wrong and that was really silly by me to use the tag as you have pointed out. Little bit carried away by the error message( - Domain: 3) . Thank you, it works fine now. yours sincerely, Christober

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.