创建具有多个图的动画-Octave/Matlab [英] Creating animation with multiple plots - Octave/Matlab

查看:319
本文介绍了创建具有多个图的动画-Octave/Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Octave编写在不同时间段绘制函数的脚本.我希望创建一个动画的情节,以查看随时间的变化.

I'm using Octave to write a script that plots a function at different time periods. I was hoping to create an animation of the plots in order to see the changes through time.

是否有办法做到这一点,从而可以每次保存每个图并以某种方式组合每个图以创建此动画?

Is there a way to do this so to possibly save each plot for each time in some way that each plot can be combined to create this animation?

在此先感谢您的指教!

Thanks in advance for the advise!

推荐答案

这将创建动画gif

data=rand(100,100,20); %100 by 100 and 20 frames

%data go from 0 to 1, so lets convert to 8 bit unsigned integers for saving
data=data*2^8;
data=uint8(data);

%Write the first frame to a file named animGif.gif
imwrite(data(:,:,1),'/tmp/animGif.gif','gif','writemode','overwrite',...
        'LoopCount',inf,'DelayTime',0);

%Loop through and write the rest of the frames
for ii=2:size(data,3)
     imwrite(data(:,:,ii),'/tmp/animGif.gif','gif','writemode','append','DelayTime',0)
end

这篇关于创建具有多个图的动画-Octave/Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆