How to make a figure counter in a for loop

1 vue (au cours des 30 derniers jours)
James
James le 14 Avr 2014
Commenté : dpb le 14 Avr 2014
Hi,
I am creating a figure in a "for loop" with the code
%Create Figure
Shift_fig(plotx) = figure('Position', [FLeft+FL_Adj FBottom-FB_Adj FWidth FHeight], 'Name', plotname, 'NumberTitle', 'off', 'Resize', 'on');
The loop runs 30 times, and after each time I want a plot of the data in that run. Hw do I make a counter for "Shift_fig(plotx)" so that at the end of the loop I have 30 figures, one for each run in the loop?
Thanks.
  1 commentaire
dpb
dpb le 14 Avr 2014
Isn't plotx a counter for the loop? You don't show enough to know for certain how you defined it, but if you've got that line in a loop it surely looks like that should be what it is...
The other answer to the question is that you don't really need to do anything special, though-- figure will create a new figure automagically with the figure handle of one greater than the highest existing figure at the time. You can save the array of figure handles if you want to access them programmatically, but their handles being integers are pretty easy to just refer to whether you've saved them explicitly or not--unless, of course, you're creating/deleting them sorta' willy-nilly, then you'd want to keep a list of valid handles updated.
What are you going to do w/ 30 figures at once, anyway, though?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by