MATLAB Functions | Help Desk |
getframe
Get movie frameM = getframe M = getframe(h) M = getframe(h,rect) [X,Map] = getframe(...)
getframe
returns a column vector containing one movie frame. The frame is a snapshot (pixmap) of the current Axes.
M = getframe
gets a frame from the current Axes.
M = getframe(h)
gets a frame from the Figure or Axes graphics object identified by h
.
M = getframe(h,rect)
specifies a rectangular area from which to copy the pixmap. rect
is relative to the lower-left corner of the Figure or Axes graphics object identified by h
, in pixel units. rect
is a four-element vector in the form [left bottom width height]
, where width
and height
define the dimensions of the rectangle.
[X,Map] = getframe(...)
returns the frame as an indexed image matrix X
and a colormap Map
. In this case, h
is a handle to a Figure or Axes object. You display the image matrix using image
or imagesc
.
Usually, getframe
is put in a for
loop to assemble movie matrix M
for playback using movie
. To prevent excessive memory use, use moviein
to allocate movie matrix M
before building the movie. This generates an appropriate size matrix of zeros.
Make the peaks
function vibrate:
Z = peaks; surf(Z)
axis
manual %Freeze Axes limits set(gca,'nextplot','replacechildren'); M = moviein(20); for j = 1:20 surf(sin(2*pi*j/20)*Z,Z) M(:,j) = getframe; end movie(M,20) % Play the movie twenty times
movie
, moviein