如何在Matlab中制作和保存视频(AVI) [英] How to make and save a video(avi) in matlab
本文介绍了如何在Matlab中制作和保存视频(AVI)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我本人正在学习matlab,并且已经使用matlab制作了动画图;现在我想将其保存为视频文件.您能告诉我如何在matlab中将动画转换为视频文件吗?下面是我的代码>
I am learning matlab myself andI have made an animated plot using matlab;now i want to save it as an video file.can you tell me how to convert my animation into a video file in matlab.Below is my code
x=[1:2];
for i=1:25,
m=randi([3,5]);
n=randi([3,5]);
y=[m n];
bar(x,y)
axis equal
A(i) = getframe;
end
matlab版本7.8 R2009a
matlab version 7.8 R2009a
推荐答案
使用avifile:
aviobj = avifile('example.avi','compression','None');
x=[1:2];
for i=1:25,
m=randi([3,5]);
n=randi([3,5]);
y=[m n];
bar(x,y)
axis equal
aviobj = addframe(aviobj,gcf);
drawnow
end
viobj = close(aviobj)
这篇关于如何在Matlab中制作和保存视频(AVI)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文