Navigation : Top/Movieの作成
Movieの作成

* 方法1 [#g25f142e]

 figure(1);clf
 for i=1:nt
    h=surf(X,Y,Z);
    M(i) = getframe(gcf);
 end
 movie2avi(M,'movie')

* もう少し本格的 [#t53121a9]

AVIフォーマットのファイルは,version 6.0より利用できるようになりました. 

 例) 
 ix_size_movie = 640;
 iy_size_movie = 480;
 
 for it=1:nt 
  if it == 1 
   figure(1); clf;
   set(gcf,'position', ... 
   [0 画面のたてサイズ-iy_size_movie ix_size_movie iy_size_movie]); 
   *** 書きたい図 ***; 
   axis([x_min x_max 0 y_max]) 
   M = moviein( nt ); 
   axis manual 
   set(gca,'nextplot','replacechildren') ; 
   %単位をpixelに
   set(0,'Units','Pixels') 
   hsize = get(gcf,'Position'); 
  end 
 
  *** 書きたい図 ***; 
  M(:,it) = getframe( gcf, [0 0 hsize(3) hsize(4)] ); 
 end 
 movie2avi( M, file_name ); 

movieは画面の左上からの領域を保存するので,"set(gcf,'Position',[x1 x2 y1 y2])"で場所を確定しないとちゃんと作れません. 

movie2aviで作られるmovieは非圧縮なのでtmpgenc(http://www.tmpgenc.com/)でmpegにすると1/10〜1/30のサイズになります. 

* movieの保存 [#ve263322]
** AVI形式 [#o7482cf4]
 movie2avi(M,cname,'COMPRESSION','Cinepak','QUALITY',90)
- 'COMPRESSION'
-- 'Indeo3'  Microsoft形式(古い, Mediaplayer非対応)
-- 'Indeo5'  Microsoft形式(古い, Mediaplayer非対応)
-- 'Cinepak' 
-- 'MSVC'    
-- 'none'    圧縮なし
-- Default
--- 'Indeo3' for MS-Windwos;
--- 'none'   for linux;
- 'fps'
-- Default = 15;
- 'QUALITY'
-- 50-100
-- Default = 75;


** mpegを直接作る [#o3a9bdd8]
つぎに直接MPEGファイルにする方法ですが、MATLABでは正式にはMPEG 
ファイルをサポートしていません。
Matlab centralにあるfreeのmpgread, mpgwriteを使用する.
*** 使い方: mpgwrite [#t6dfc377]
 mpgwrite(M,map,filename)
 例)
 mpgwrite(M,jet,'example')
*** Link [#h0277bbe]
- http://www.mathworks.com/support/solutions/data/1-1MAQY5.html?solution=1-1MAQY5
-- http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=308&objectType=file
-- http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=309&objectType=file