从Matlab导出电影 [英] Exporting movie from matlab

查看:219
本文介绍了从Matlab导出电影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在matlab中制作电影.

I am trying to make a movie in matlab.

for i=1:runs;
       for k=1:NO_TIMES
       B = 0;
       [conf dom_size] = conf_update_massmedia(time(k),conf);


       shortconf=conf(1:N);
       for j=1:N;
       sigma(j,1:N) = conf(1+(j-1)*N:j*N);
       end
    figure(1)
    imagesc(sigma);
    colorbar;
    set(gcf,'PaperPositionMode','auto');
    F(k)=getframe(gcf);
    end

end

movie2avi(F,'B=0.avi','Compression','none')

所以我的问题是,我只能从循环的最后一次运行中得到一部电影,我曾尝试移动该人物的代码,但似乎没有任何效果,有人可以提供帮助吗?

So my problem is that i only get a movie from the last run of the loop, i have tried to move the code for the figure around, but nothing seems to work, is there anyone who are able to help?

鲍尔

推荐答案

movie2avi有点过时并在各种操作系统上苦苦挣扎.更好的选择是使用VideoWriter命令:

movie2avi is a little outdated and struggles on various operating systems. A better option is using the VideoWriter command:

vidObj = VideoWriter('B=0.avi');
vidObj.FrameRate=23;
open(vidObj);

for i=1:runs;
   for k=1:NO_TIMES
      B = 0;
      [conf dom_size] = conf_update_massmedia(time(k),conf);
      shortconf=conf(1:N);

      for j=1:N;
         sigma(j,1:N) = conf(1+(j-1)*N:j*N);
      end

      figure(1)
         imagesc(sigma);
         colorbar;
         set(gcf,'PaperPositionMode','auto');

      F=getframe(gcf);
      writeVideo(vidObj,F);
    end
end

close(vidObj);

这篇关于从Matlab导出电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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