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.

Geometry using loop

Please login with a confirmed email address before reporting spam

Hi,
In my model the number of rectangles in geometry is user input dependent variable. So I need to use a loop to create the geometry. So I have written the following code,

N=input ('Enter the number')
for i3=1:N

g(i3+1)=rect2(100e-6,12e-6,'base','corner','pos',[0,depth]);
depth=depth+10e-6;
end

Is this format g(i3+1) is acceptable for COMSOL ? If no then how should I write it?
Please help.

6 Replies Last Post 2011年3月28日 GMT-4 04:45
COMSOL Moderator

Hello Ahmad Zubair

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: 1 decade ago 2011年1月26日 GMT-5 23:53
Have you got any answer for this problem? I am also looking the same
Have you got any answer for this problem? I am also looking the same

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月27日 GMT-5 01:16
Hi

first of all you should specify the version you are using, that would stimulate the right people here on the Forum.

Then, why not try it out and see in the COMSOL GUI environment what you get ?

--
Good luck
Ivar
Hi first of all you should specify the version you are using, that would stimulate the right people here on the Forum. Then, why not try it out and see in the COMSOL GUI environment what you get ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月27日 GMT-5 04:41
No, I'm still in the same problem
No, I'm still in the same problem

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月27日 GMT-5 05:03
I need to built a model that can be used for structures with different number of subdomains based on the users demand. Is there any way to do it using GUI?
I need to built a model that can be used for structures with different number of subdomains based on the users demand. Is there any way to do it using GUI?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月25日 GMT-4 11:28
I stere a solution to this Problem availible?
I stere a solution to this Problem availible?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年3月28日 GMT-4 04:45
Hello, I am new to this forum and I see a lot of topics open like this. Is there an active community or is this dead?

I also try to build a geometry using a loop:

for i=1:L
g{i}=rect2(0.8,width*i,'base','corner','pos',[0,width*(i-1)]);
s.objs={g1(i)};
s.name{i}='R' & num2str(i);
s.tags{i}= 'g' & num2str(i);
end

but it appears not to work out. Is there a solution for this? If one has a solution could he/she post the correct syntax (not like this www.comsol.com/community/forums/general/thread/6131/ )
Hello, I am new to this forum and I see a lot of topics open like this. Is there an active community or is this dead? I also try to build a geometry using a loop: for i=1:L g{i}=rect2(0.8,width*i,'base','corner','pos',[0,width*(i-1)]); s.objs={g1(i)}; s.name{i}='R' & num2str(i); s.tags{i}= 'g' & num2str(i); end but it appears not to work out. Is there a solution for this? If one has a solution could he/she post the correct syntax (not like this http://www.comsol.com/community/forums/general/thread/6131/ )

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.