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.
Getting derived values into matlab variables
Posted Mar 9, 2012, 3:53 a.m. EST Low-Frequency Electromagnetics, Interfacing, Parameters, Variables, & Functions Version 4.2 3 Replies
Please login with a confirmed email address before reporting spam
Hello!
I have some trouble getting the value of an average operator into a matlab variable when using comsol through matlab.
What I get when I translate the model into an .m file is this:
model.result.numerical.create('av2', 'AvSurface');
model.result.numerical('av2').selection.all;
model.result.numerical('av2').selection.set([2]);
model.result.numerical('av2').set('expr', 'sqrt((mfnc.Br*d(mfnc.Br,r)+mfnc.Bphi*(1/r)*d(mfnc.Br,phi)+mfnc.Bz*d(mfnc.Br,z))^2+(mfnc.Br*d(mfnc.Bphi,r)+mfnc.Bphi*(1/r)*d(mfnc.Bphi,phi)+mfnc.Bz*d(mfnc.Bphi,z))^2+(mfnc.Br*d(mfnc.Bz,r)+mfnc.Bphi*(1/r)*d(mfnc.Bz,phi)+mfnc.Bz*d(mfnc.Bz,z))^2)');
What I want to do is get the value of 'av2' into a matlab variable. I tried using mpheval and mphglobal but it didnt work, not sure if I am using them right. Does anyone have any ideas?
Thanks in advance!
I have some trouble getting the value of an average operator into a matlab variable when using comsol through matlab.
What I get when I translate the model into an .m file is this:
model.result.numerical.create('av2', 'AvSurface');
model.result.numerical('av2').selection.all;
model.result.numerical('av2').selection.set([2]);
model.result.numerical('av2').set('expr', 'sqrt((mfnc.Br*d(mfnc.Br,r)+mfnc.Bphi*(1/r)*d(mfnc.Br,phi)+mfnc.Bz*d(mfnc.Br,z))^2+(mfnc.Br*d(mfnc.Bphi,r)+mfnc.Bphi*(1/r)*d(mfnc.Bphi,phi)+mfnc.Bz*d(mfnc.Bphi,z))^2+(mfnc.Br*d(mfnc.Bz,r)+mfnc.Bphi*(1/r)*d(mfnc.Bz,phi)+mfnc.Bz*d(mfnc.Bz,z))^2)');
What I want to do is get the value of 'av2' into a matlab variable. I tried using mpheval and mphglobal but it didnt work, not sure if I am using them right. Does anyone have any ideas?
Thanks in advance!
3 Replies Last Post Nov 20, 2013, 12:22 p.m. EST