save animation in subplot

13 次查看(过去 30 天)
I'm using
while
drawnow;hold off
end
to create an animation. But this animation is just the 6th position as in subplot(2,3,6) (or through next tile repeatedly). To save this animation to the computer while not keeping the other subplots 1~5, what to do?
  2 个评论
Walter Roberson
Walter Roberson 2024-8-16
??
That is an infinite loop. Inside the infinite loop, you request that the graphics queue be flushed, and you turn off hold . But you do not do anything else -- no drawing at all, no recording of previously drawn material.
It is not clear what you are trying to do?
feynman feynman
feynman feynman 2024-11-14,5:03
thanks for your answer. I omitted '%draw something' as in your code

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2024-8-16
ax6 = subplot(2,3,6);
count = 0;
while true
%draw something
count = count + 1;
filename = fullfile(SAVEDIRECTORY, "image" + count + ".png");
exportgraphics(ax6, filename);
end
  4 个评论
feynman feynman
feynman feynman 2024-11-18,6:03
编辑:feynman feynman 2024-11-18,6:04
good to hear that. Then how does ax6 = subplot(2,3,6) get in without exportgraphics()?
Walter Roberson
Walter Roberson 2024-11-18,6:11
You have getframe(gcf) which captures the image of the entire current figure.
Note that you could also getframe(ax6) if you wanted to capture subplot(2,3,6) only.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by