Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
29.10.2019, 04:59 GMT-4
Updated:
5 years ago
29.10.2019, 01:05 GMT-4
Hi Owen
Your script looks fine. Note however, that it is usually much easier to work with a model that is saved as an MPH-file since you often can load that file a lot faster than the time it takes to build the model from scratch.
As far as I can tell your script already makes a plot that plots emw.normE (since this is the default expression)!
The easiest way to learn about what commands to use when changing a setting in a model is to
- Open or create the model in Matlab (If you load the file using mphload or mphopen you must enable history recording. See the help text for more info)
- Use the command mphlaunch to open the Comsol GUI
- Make the changes to the model in the Comsol GUI
- Save the model as an M-file (e.g.: mphsave(model, 'modelfilename.m') )
- Open the M-file in the editor and look at the last lines of the file
- Copy the lines you need to your own scripts.
Alternatively, you can use mphnavigator to view and setting in a model. Once you have found a property you wish to change you can use the button "Copy set" that will copy the statement that sets the property to the clipboard.
-------------------
Lars Gregersen
Comsol Denmark
Hi Owen
Your script looks fine. Note however, that it is usually much easier to work with a model that is saved as an MPH-file since you often can load that file a lot faster than the time it takes to build the model from scratch.
As far as I can tell your script already makes a plot that plots emw.normE (since this is the default expression)!
The easiest way to learn about what commands to use when changing a setting in a model is to
1. Open or create the model in Matlab (If you load the file using mphload or mphopen you must enable history recording. See the help text for more info)
2. Use the command mphlaunch to open the Comsol GUI
3. Make the changes to the model in the Comsol GUI
4. Save the model as an M-file (e.g.: mphsave(model, 'modelfilename.m') )
5. Open the M-file in the editor and look at the last lines of the file
6. Copy the lines you need to your own scripts.
Alternatively, you can use mphnavigator to view and setting in a model. Once you have found a property you wish to change you can use the button "Copy set" that will copy the statement that sets the property to the clipboard.