%=============================================================== function mpegDemo %=============================================================== % % You need to download the mpgwrite files from below, and then % add the corresponding directoy to your path (via menu or % "addpath" command) % % http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=309&objectType=file % %================================================================ myFigure(0,12,0,8); r = makeRobot(2,2,-pi/4,0.5,'r'); n = 1; for i=1:15 % Takes the active figure and saves it as a movie frame frame(n) = getframe; % Update the frame number n = n+1; % Move the robot for our animation r = moveRobot(r, r.x+.5, r.y, r.theta); end % Saves the animation to test.mpg map = colormap; mpgwrite(frame, map, 'test', [1, 0, 1, 1, 10, 8, 10, 25]);