clc; clear; fig=figure; aviobj=avifile('e:\role0\1\21.avi'); n=50; x=0:pi/n:2*pi; y=sin(x); k=0; for t=0:pi/n:2*pi k=k+1; x(k)=t; y(k)=sin(t); H=plot(x,y,x(k),y(k),'or'); grid MOV=getframe(fig); aviobj=addframe(aviobj,MOV); end close(fig) aviobj=close(aviobj)
原文地址:http://blog.csdn.net/whk100312/article/details/45639593