MATLAB Function Reference |

**Syntax**

**Description**

```
movie
```

plays the movie defined by a matrix whose columns are movie frames (usually produced by `getframe`

).

```
movie(M)
```

plays the movie in matrix `M`

once.

```
movie(M,n)
```

plays the movie `n`

times. If `n`

is negative, each cycle is shown forward then backward. If `n`

is a vector, the first element is the number of times to play the movie, and the remaining elements make up a list of frames to play in the movie.

For example, if `M`

has four frames then `n = [10 4 4 2 1]`

plays the movie ten times, and the movie consists of frame `4`

followed by frame `4`

again, followed by frame `2`

and finally frame `1`

.

```
movie(M,n,fps)
```

plays the movie at `fps`

frames per second. The default is 12 frames per second. Computers that cannot achieve the specified speed play as fast as possible.

```
movie(h,...)
```

plays the movie centered in the figure or axes identified by the handle `h`

.

```
movie(h,M,n,fps,loc)
```

specifies a four-element location vector, `[x y 0 0]`

, where the lower left corner of the movie frame is anchored (only the first two elements in the vector are used). The location is relative to the lower left corner of the figure or axes specified by `handle`

`h`

and in units of pixels, regardless of the object's `Units`

property.

**Remarks**

The `movie`

function displays each frame as it loads the data into memory, and then plays the movie. This eliminates long delays with a blank screen when you load a memory-intensive movie. The movie's load cycle is not considered one of the movie repetitions.

**Examples**

Animate the `peaks`

function as you scale the values of `Z`

:

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 % Play the movie twenty times movie(F,20)

**See Also**

`aviread`

, `getframe`

, `frame2im`

, `im2frame`

Animation for related functions

See Example - Visualizing an FFT as a Movie for another example

movegui | movie2avi |

© 1994-2005 The MathWorks, Inc.