Sequentially naming figures or objects
Afficher commentaires plus anciens
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
Réponses (1)
Sean de Wolski
le 30 Juil 2012
for ii = 1:3,
figure('Name',sprintf('g%i',ii),'NumberTitle','off');
end
?
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!