Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how to put out figure one by one when many figures should be put out?

1 visualizzazione (ultimi 30 giorni)
I have saved about 1,000 txt files on my PC somewhere; Now I want to scan the data of all these files, and select some ones to make figures according to the files' data (one selected file, one figure); so my logic code is as below:
for i=1:1000
if .....%(if selected)
figure;
end
end
Then I run the code and I find 45 figures were created, but the figures were created all at the end when 1,000 txt files were checked rather than one by one(check one file, if selected, figure). why?
in addition, the same code run well on matlab2012b(one by one), but not well on matlab2014b(all together at the end). or matlab2014b making all figures at the end is better? I find at the end, when all the figures were created together, my PC is very busy and hot, which I don't want to .

Risposte (2)

Walter Roberson
Walter Roberson il 12 Nov 2015
After you finish plotting any one figure, use drawnow() . This should not normally be necessary as MATLAB should update graphics each time you figure() a new figure into existence, but I have seen reference to an R2014b / R2015a case in which drawnow needed to be used due to a graphics bug.

vx2008
vx2008 il 13 Nov 2015
Thank you!
in addition, making figure one by one is better or doing together is better for matlab's computing effectivity and PC's ability?
  1 Commento
Walter Roberson
Walter Roberson il 13 Nov 2015
If you do not need multiple figures displayed at the same time then it would generally be better not to have them displayed at the same time. Every figure that is simultaneously displayed requires graphics memory and requires data structures about how it should be interacted with, so you can reduce the workload on the system by getting rid of figures that you are finished with.

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by