Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
vx2008
vx2008 2015 年 11 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 .

回答 (2 件)

Walter Roberson
Walter Roberson 2015 年 11 月 12 日
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 2015 年 11 月 13 日
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 件のコメント
Walter Roberson
Walter Roberson 2015 年 11 月 13 日
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.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by