| MATLAB Function Reference | ![]() |
aviobj = addframe(aviobj,frame)
aviobj = addframe(aviobj,frame1,frame2,frame3,...)
aviobj = addframe(aviobj,mov)
aviobj = addframe(aviobj,h)
aviobj = addframe(aviobj,frame) appends the data in frame to the AVI file identified by aviobj, which was created by a previous call to avifile. frame can be either an indexed image (m-by-n) or a truecolor image (m-by-n-by-3) of double or uint8 precision. If frame is not the first frame added to the AVI file, it must be consistent with the dimensions of the previous frames.
addframe returns a handle to the updated AVI file object, aviobj. For example, addframe updates the TotalFrames property of the AVI file object each time it adds a frame to the AVI file.
aviobj = addframe(aviobj,frame1,frame2,frame3,...) adds multiple frames to an AVI file.
aviobj = addframe(aviobj,mov) appends the frames contained in the MATLAB movie mov to the AVI file aviobj. MATLAB movies that store frames as indexed images use the colormap in the first frame as the colormap for the AVI file, unless the colormap has been previously set.
aviobj = addframe(aviobj,h) captures a frame from the figure or axis handle h and appends this frame to the AVI file. addframe renders the figure into an offscreen array before appending it to the AVI file. This ensures that the figure is written correctly to the AVI file even if the figure is obscured on the screen by another window or screen saver.
Note If an animation uses XOR graphics, you must use getframe to capture the graphics into a frame of a MATLAB movie. You can then add the frame to an AVI movie using the addframe syntax aviobj = addframe(aviobj,mov). See the example for an illustration. |
This example calls addframe to add frames to the AVI file object aviobj.
fig=figure;
set(fig,'DoubleBuffer','on');
set(gca,'xlim',[-80 80],'ylim',[-80 80],...
'nextplot','replace','Visible','off')
aviobj = avifile('example.avi')
x = -pi:.1:pi;
radius = 0:length(x);
for i=1:length(x)
h = patch(sin(x)*radius(i),cos(x)*radius(i),...
[abs(cos(x(i))) 0 0]);
set(h,'EraseMode','xor');
frame = getframe(gca);
aviobj = addframe(aviobj,frame);
end
aviobj = close(aviobj);![]() | addevent | addlistener (handle) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |