next up previous contents
Next: The Session Up: Graphics Previous: Surface Plots


MATLAB provides simple animation capabilities with three movie functions: moviein, getframe, and movie. A movie consists of a series of frames, a frame being a special MATLAB object that holds a copy of the current picture, based on the current axis. A movie is a matrix whose columns are frames.

Because of the way MATLAB handles matrix resizing, you will suffer if you do not preallocate the movie matrix. Use mov = moviein(nframes) to make mov a matrix capable of holding nframes frames of the current axis and contents. If you will be getting frames (see below) for a specific object, and perhaps in a specific position rectangle, allocate the matrix as mov = moviein(nframes, handle, rectangle) or mov = moviein(nframes, handle).

Build your movie matrix out of columns provided by getframe. By itself getframe gets a frame of the current axis and contents. As getframe(handle) (or getframe(handle, rectangle)) it gets a frame from the object specified by handle (in the rectangle region, from the lower left corner, in the 'Units' property units). The calls to getframe to build a movie should be consistent with each other and the moviein preallocation call.

The function movie(handle, mov, n) plays the movie mov in the object given by handle (or in the current figure if handle is omitted) n times (once if n is omitted). A negative n plays the movie back and forth each time. A vector n gives the repetitions in the first element and the frames to play, in order, in succeeding elements. An optional extra argument specifies the frames per second (defaulting to 12), limited by machine capabilities. An optional further extra argument specifies the location to play at, from the lower left corner, in the 'Units' property units.

Sat Mar 21 21:42:28 EST 1998