Sequentially naming figures or objects

I'm using COMSOL multiphysics to create a series of gratings to solving a problem involving Surface Plasmon Resonance. The underlying code behind COMSOL is Matlab. This is the code that COMSOL uses to generate a rectangle of specific dimensions and orientation (I added the "loop" though):
% Geometry
w = 50*10^-9;
wstr = num2str(w);
s = 70*10^-9;
d = 40*10^-9;
dstr = num2str(d); negd=num2str(-1*d);
for q = 1:1
%g(1)= whole figure; g(2)= sub-domain:dielectric
k=num2str((q-1)*(w+s));
g3=rect2(wstr,dstr,'base','corner','pos',{k,negd},'rot','0');
end
--
What I want to do is create a loop that names each figure(g3, g4, g5, etc.) The problem I'm having is every solution I've found involving sequential naming involves an incompatible data type such as a cell array. What I need is for g3, g4, g5, etc. to be a figure or object. I tried doing something along the lines of:
for i=3:10
['g' num2str(i)]= rect2(wstr,dstr,'base','corner','pos',{k,negd},'rot','0');
end
but this gives me a LHS assignment error. Anybody have any thoughts or suggestions?
Thanks,
Dan

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 7월 30일

0 개 추천

for ii = 1:3,
figure('Name',sprintf('g%i',ii),'NumberTitle','off');
end
?

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

질문:

Dan
2012년 7월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by