Advertisement
phy_bunny

create_video

Sep 4th, 2023
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.58 KB | None | 0 0
  1. figure                                 % 创建图窗
  2. myVideo=VideoWriter('VideoFile_test'); % 指定视频文件名
  3. open(myVideo)                          % open开始写入
  4. myVideo.FrameRate=30;                  %调整视频帧率        
  5. x=0:0.01:2*pi; % 函数曲线绘图范围
  6.  
  7. for i=1:100
  8.     plot(x,sin(x+i/100*2*pi),'LineWidth',2);
  9.     drawnow                           % 即时显示当前图窗
  10.     Fr=getframe(gcf);                 % 抓取图窗
  11.     writeVideo(myVideo,Fr);           % 写入文件
  12. end
  13. close(myVideo)                        % close文件,结束
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement