title: movie2avi - how to fix the frame size?
body: <p>I have searched stackoverflow for a similar question and I found question "movie2avi-frame-size-error-and-keeping-frame-size-constant".  Unfortunately the answer given there did not solve my problem (it has been suggested the use of xlim, ylim and zlim).</p>
  
  <p>In what follows I send a lightly modified version of a well-known example given elsewhere.</p>
  
  <pre><code>%# figure
  figure, set(gcf, 'Color','white')
  Z = peaks; surf(Z);  axis tight
  set(gca, 'nextplot','replacechildren', 'Visible','off');
  [az,el]=view;
  xl=xlim;
  yl=ylim;
  zl=zlim;
  
  %# preallocate
  nFrames = 20;
  mov(1:nFrames) = struct('cdata',[], 'colormap',[]);
  
  %# create movie
  for k=1:nFrames
     view([(az-k*10) el]);
     xlim(xl);ylim(yl);zlim(zl);
     drawnow;pause(0.1);
     mov(k) = getframe(gca);
  end
  close(gcf)
  
  %# save as AVI file, and open it using system video player
  movie2avi(mov, 'myPeaks1.avi', 'compression','None', 'fps',10);
  </code></pre>
  
  <p>The idea is to rotate the figure and create a movie.  Everything works fine except for the last command, that is, movie2avi.  The error msg is</p>
  
  <pre><code>Error using avifile/addframe&gt;ValidateFrame (line 290)
  Frame must be 435 by 344.
  
  Error in avifile/addframe (line 158)
  ValidateFrame(aviobj,width, height,dims);
  
  Error in movie2avi (line 67)
  avimov = addframe(avimov,mov);
  
  Error in more_video_test (line 24)
  movie2avi(mov, 'myPeaks1.avi', 'compression','None', 'fps',10); 
  </code></pre>
  
  <p>I have looked at approaches-to-create-a-video-in-matlab here in stackoverflow and found that:</p>
  
  <p>a) Solution ffmpeg works but I would like to avoid it.<br>
  b) All other solutions failed even QTWriter.  How can I fix the frame size so that all these other solutions work?  </p>
  
  <p>Many thanks.</p>
  
  <p>Ed</p>