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 ExchangeMATLAB についてさらに検索

製品

質問済み:

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