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.
Trouble extracting a derived value into Matlab
Posted Mar 7, 2012, 6:09 a.m. EST Interfacing 1 Reply
Please login with a confirmed email address before reporting spam
As the title says I got some trouble getting numerical values from my derived values into matlab variables when using the livelink for matlab. What I do is I create a model in comsol, save it as an .m file, turn it into a function and use it in an optimization algorithm. Thus I need to get a comsol derived value into a matlab variable to close the loop.
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?
Hello George Kanakaris
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.