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.

Measure area with matlab

Please login with a confirmed email address before reporting spam

Hello,

i recently started using matlab for optimization purposes and im stuck with the problem of measuring the area of my model. I want to get the area of Domain 1.
I viewed the *.m file for it and it creates:
"model.material('mat5').selection.set([1]);"
This appears to select domain 1 for the material 5...so how do I address this? And with wich function?
I googled
"model.geom('geom1').measureFinal.selection.set([1])"
to apparently get the area, but all i get in Matlab is
"ans =
Dimension 2: Geometry geom1; Domain 1"

How do I get the area of something before solving the model (as it is possible in the Workspace)?
Also: Where can I get this kind of information? Is there some kind of overview of all functions? Its not in the documentation...

Thanks in advance

1 Reply Last Post 03.07.2017, 15:51 GMT-4
COMSOL Moderator

Hello E Sing

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.


Please login with a confirmed email address before reporting spam

Posted: 7 years ago 03.07.2017, 15:51 GMT-4
This codes below give you the area:

model.geom('geom1').measureFinal.selection.geom('geom1', 2);
model.geom('geom1').measureFinal.selection.set([1]);
model.geom('geom1').measureFinal.getVolume

I want to get the perimeter. They claim that this same code gives the Volume, area and perimeter. But I have not been able to get the perimeter with it. Please, let me know if you have a way around the perimeter. Thank you.
This codes below give you the area: model.geom('geom1').measureFinal.selection.geom('geom1', 2); model.geom('geom1').measureFinal.selection.set([1]); model.geom('geom1').measureFinal.getVolume I want to get the perimeter. They claim that this same code gives the Volume, area and perimeter. But I have not been able to get the perimeter with it. Please, let me know if you have a way around the perimeter. Thank you.

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.