| s = subplot(2,1,2) Z = peaks; surf(Z); axis tight set(gca,'nextplot','replacechildren'); % Record the movie for j = 1:20 axes(r) surf(sin(2*pi*j/20)*Z,Z) axes(s) surf(sin(2*pi*(j+5)/20)*Z,Z) F(j) = getframe(gcf); pause(.0333) end % Play the movie; note that it does not fit the figure properly: h2 = figure; movie(F,10) % Use the figure handle to make the frames fit: movie(h2,F,10) Example 3: With larger frames, first adjust the figure's size to fit the movie: figure('position',[100 100 850 600]) Z = peaks; surf(Z); axis tight set(gca,'nextplot','replacechildren'); % Record the movie for j = 1:20 surf(sin(2*pi*j/20)*Z,Z) F(j) = getframe; end [h, w, p] = size(F(1).cdata); % use 1st frame to get dimensions hf = figure; % resize figure based on frame's w x h, and place at (150, 150) set(hf, 'position', [150 150 w h]); axis off % tell movie command to place frames at bottom left |