Movies on OS X
4 views (last 30 days)
Show older comments
Hello Everyone,
I am trying to save a movie in Matlab. The figure display correctly however the movie file doesn't the figure window but it shows a part of figure window and part of the Matlab UI. I am using Matlab 2013a on OS X 10.9.4. I am pasting the code below. Please suggest why this is happening. I dock the figure window to the Matlab desktop by default.
clear;
close all;
% Creates a 2D Mesh to plot surface
x=linspace(0,1,100);
[X,Y] = meshgrid(x,x);
N=100; % Number of frames
set(gca,'nextplot','replacechildren');
set(gcf,'Renderer','zbuffer');
M(N) = struct('cdata',[],'colormap',[]);
for i = 1:N
% Example of plot
Z = sin(2*pi*(X-i/N)).*sin(2*pi*(Y-i/N));
surf(X,Y,Z)
% Store the frame
M(i)=getframe; % leaving gcf out crops the frame in the movie.
end
myVideo = VideoWriter('wavemotion.m4v', 'MPEG-4');
open(myVideo);
writeVideo(myVideo,M)
close(myVideo)
0 Comments
Answers (0)
See Also
Categories
Find more on Animation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!