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 Dec 21, 2010, 1:21 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 20, 2010, 7:10 a.m. EST
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 Dec 20, 2010, 7:39 a.m. EST
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 Dec 20, 2010, 8:43 a.m. EST
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 Dec 21, 2010, 1:21 a.m. EST
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.