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.

View global data in Matlab

Please login with a confirmed email address before reporting spam

Dear all,
I calculated the magnetic force between two magnets. I can get the force through postprocessing->data display->global and write name_forcex_emqa under the expression. The force is then displayed in the dialog.
I have now saved the .m file and run the simulation in matlab.
How can I get the resulting magnetic force? Which command should I use?
I need this because I would change the geometry and run various simulation and automatically display force.

Thank you

Blaz

4 Replies Last Post 2010/12/21 1:21 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/20 7:10 GMT-5
Hi Blaz,

if you are working with COMSOL 3.5, I think you are looking for this command:
data = postglobaleval(fem, 'name_forcex_emqa')
Find your results in the structure under data.y

Good luck
Stefan
Hi Blaz, if you are working with COMSOL 3.5, I think you are looking for this command: data = postglobaleval(fem, 'name_forcex_emqa') Find your results in the structure under data.y Good luck Stefan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/20 7:39 GMT-5
I tried that and I get:

>> data = postglobaleval(fem, 'mag1_forcex_emqa')
??? Error using ==> postglobaleval at 70
Expression must be a cell array.

Thank you very much for your support

Blaz
I tried that and I get: >> data = postglobaleval(fem, 'mag1_forcex_emqa') ??? Error using ==> postglobaleval at 70 Expression must be a cell array. Thank you very much for your support Blaz

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/20 8:43 GMT-5
There was a little mistake. You have to write the variables as a cell array. Now we have:
data = postglobaleval(fem, {'mag1_forcex_emqa'})

Good luck
Stefan
There was a little mistake. You have to write the variables as a cell array. Now we have: data = postglobaleval(fem, {'mag1_forcex_emqa'}) Good luck Stefan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/21 1:21 GMT-5
Thank you very much. It works :)
Thank you very much. It works :)

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.