# getframe

## Purpose

Get movie frame.

## Synopsis

    M = getframe
    M = getframe(h)
    M = getframe(h,rect)

## Description

`getframe` returns a column vector with one movie frame. The frame is a snapshot (pixmap) of the current axes. `getframe` is usually put in a `for` loop to assemble movie matrix `M` for playback using `movie`.

`getframe(h)` gets a frame from object `h`, where `h` is a handle to the root, a figure, or an axes.

`getframe(h,rect)` specifies the rectangle to copy the bitmap from, relative to the lower-left corner of object `h`, and in the units of its `Units` property.

    rect = [left  bottom  width  height]

where `width` and `height` define the dimensions of the rectangle.

To prevent excessive memory use, it is preferable to preallocate movie matrix `M` before building the movie. The function `moviein` generates a matrix of zeros of the appropriate size.

## Examples

Make the peaks function vibrate:

    z = peaks;
    surf(z)
    lim = axis;
    M = moviein(20);
    for j = 1:20
        surf(sin(2*pi*j/20)*z,z)
        axis(lim)
        M(:,j) = getframe;
    end
    movie(M,20)% Play the movie twenty times

## See Also

    movie, moviein

(c) Copyright 1994 by The MathWorks, Inc.