Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 26527

Getting derived values into matlab variables

$
0
0
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!

Viewing all articles
Browse latest Browse all 26527

Trending Articles