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.

extracting data from comsol to matlab through mphinterp

Please login with a confirmed email address before reporting spam

Hello,

I have implemented the mphinterp function but when I want to extract results for different parameters something goes wrong.

My typical comsolfiles look something like this:

- In the Study section I have Step1: Boundary Mode Analysis and in Step 2: Frequency Domain Analysis (and in front of these two a Parametric sweep)

- I have 3 data sets in the Result section : Solution 1, Solution 2, Solution 3 and Solution 3 is the one that contains the parametric sweep (e.g. 24 different parameter combinations)

In my MATLAB file I have a for loop that loops over all parameter numbers

for i=1:nr_param
...
mphinterp(model1,'emw.normE','coord',grid3D,'Dataset','Solution 3','Solnum',i);
...
end

I extract emw.normE from model1 for a given grid3D. I select the dataset Solution3 and in 'Solnum' I select each time another parameter i (determined by the for loop). But it already errors with Solution 3. If I only put

mphinterp(model1,'emw.normE','coord',grid3D,'Solnum',i);

then I can extract one parameter, but from the second one it again errors.

Could somebody please tell me what is going wrong in the above scheme. So how can I exactly say matlab that I want to extract emw.normE from Solution 3 and that it only extracts one parameter at a time?


Thanks in advance,
F.Peyskens

2 Replies Last Post 07.01.2013, 04:35 GMT-5
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.12.2012, 04:48 GMT-5
Hi

When you specify the dataset you have to specify the tag of the dataset and not its name.

You can switch on display of tags in Comsol by selecting View->Model Builder Node Label->Show Name and Tag.

The tags for datasets are usually of the form dset1, dset2, etc.


When you have a parametric sweep you have to specify the argument 'outersolnum'.


Feel free to attach a model here or send your model to Comsol support if you need a more specific answer.


--
Lars Gregersen
Technical Product Manager
Comsol Denmark
Hi When you specify the dataset you have to specify the tag of the dataset and not its name. You can switch on display of tags in Comsol by selecting View->Model Builder Node Label->Show Name and Tag. The tags for datasets are usually of the form dset1, dset2, etc. When you have a parametric sweep you have to specify the argument 'outersolnum'. Feel free to attach a model here or send your model to Comsol support if you need a more specific answer. -- Lars Gregersen Technical Product Manager Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.01.2013, 04:35 GMT-5
Hello,

Thank you very much for this response and sorry for my late reply. I tried different things and the mehtod you suggest over here is indeed the one that worked for me.

Kind regards,
F.Peyskens
Hello, Thank you very much for this response and sorry for my late reply. I tried different things and the mehtod you suggest over here is indeed the one that worked for me. Kind regards, F.Peyskens

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.