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.

passing arrays as parameters into geometry features via MATLAB LiveLink

Please login with a confirmed email address before reporting spam

Hello all,

I have a matlab code which gives positions of certain features in arrays.
eg:

x_position = {1,2,3,4,5};
y_position = {1,2,3,4,5};
z_position = {1,2,3,4,5};
r_placed = {1,1,1,1,1};

I want to use these parameters to create geometry in comsol.

How should I change the following lines to achieve that feature?

count = 1;
for i=1:length(r_placed)
model.geom('geom1').feature().create(strcat('s',int2str(count)),'Sphere');
model.geom('geom1').feature(strcat('s',int2str(count))).set('r','r_placed(i)');
model.geom('geom1').feature(strcat('s',int2str(count))).set('pos', 'x_position(i) y_position(i) z_position(i)');
count=count+1;
end

Thank you.

0 Replies Last Post 2011年10月12日 GMT-4 11:32
COMSOL Moderator

Hello Sandeep Mallampati

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.

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.