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.

Accessing a pre-existing model node from MATLAB

Please login with a confirmed email address before reporting spam

Hello!

I have created a model using the Comsol interface which automatically generates a geometry node (by default, "Geometry 1"). Using MATLAB I wish to add the entity c1 (see below) to the "Geometry 1" node but I receive the following error message: "Undefined variable "geom1" or class "geom1.feature.create"."

My code is:

model.component('comp1').geom('geom1').lengthUnit('mm');

c1 = geom1.feature.create('c1','Circle'); c1.set('r',Ro); c1.set('pos',[0 0]);

Thank you in advance.


1 Reply Last Post 2017年12月21日 GMT-5 03:38
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 2017年12月21日 GMT-5 03:38

Hi André

You can either do

c1 = Model.geom('geom1').feature.create('c1','Circle'); c1.set('r',Ro); c1.set('pos',[0 0]);

or

geom1 = Model.geom('geom1'); c1 = geom1.feature.create('c1','Circle'); c1.set('r',Ro); c1.set('pos',[0 0]);

-------------------
Lars Gregersen
Comsol Denmark
Hi André You can either do c1 = Model.geom('geom1').feature.create('c1','Circle'); c1.set('r',Ro); c1.set('pos',[0 0]); or geom1 = Model.geom('geom1'); c1 = geom1.feature.create('c1','Circle'); c1.set('r',Ro); c1.set('pos',[0 0]);

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.