User`s guide

GUI for Animating a 3-D View (GUIDE)
example d oes not explore the technique, but you can find information about
programming timers in “Using a MATLA B T im er O bject”.
Make a Movie of the Animation
Selecting the Make movie check box before clicking Spin causes the
applicationtorecordeachframedisplayedinthe
while loop of the
spinstopbutton_Callback routine. W hen the user selects this check box, the
animation runs more slowly because the following block of code executes:
filming = handles.movie;
...
if ishandle( hand les.axes1) && filmi ng > 0 && filmi ng < 361
globeframes(filming) = getframe; % Capture axes i n movie
filming = filming + 1;
end
Because it is the value of a check box, handles. movi e is either 0 or 1. When
it is 1, a copy (
filming) of it keeps a count of the number of frames saved
in the
globeframes matrix (which contains the axes CData and colormap
for each frame). Users cannot toggle saving the movie on or off while the
globe is spinning, because the
while loop code does not monitor the state of
the Make movie check box.
The
ishandle test prevents the ge tframe from generating an error if the axes
is destroyed before the
while loop finishes.
When the
while loop is terminated by the user, the callback prints the results
of capturing movie frames to the Command Window and writes the movie to
a MAT-file:
if (filming)
filename = sprintf('globe%i.mat',f ilming-1);
disp(['Writing movie to file ' filename]);
save (filename, 'globeframes')
end
Note Before creating a movie file with the GUI, make sure that you have
write permission for the current folder.
10-23