File Exchange

image thumbnail


version 1.0 (2.02 MB) by

Animate Handle Graphics objects

18 Ratings



No License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

ANYMATE can be used to easily animate Matlab plots. It is very general and is not limited to any specific plot type or specific object. Given a plot function and some data, a useful animation can often be accomplished with just a single line of code. It is also possible to create an animation from existing figures.

The generated animations are not Matlab movies, but are instead real Handle Graphics objects, having the capability to change their appearences in real time. The changes are performed in the background and any Matlab command can be entered while an animation is active, including changing the properties of an animated object.

Plots can be zoomed, panned and rotated while the animation is running.

Animations can be saved as normal .fig files and started immediately, just by opening the file. Animations can also be saved as GIF, AVI and WMV files.

For more information and examples, see the attached HTML file, which, by the way, is the reason for the heavy download size, since the HTML contains animated GIF files.

The author wishes to thank John D'Errico for beta-testing ANYMATE, making sure that ANYMATE also works on a Mac.

Comments and Ratings (20)

Amr AbdelAty

Brett Shoelson

Brett Shoelson (view profile)

Jerker, This is a valuable addition to the File Exchange. It needs some updating, though.... I hope you'll consider replacing deprecated functionality to render it useful in current versions of MATLAB.


arnold (view profile)

great stuff. I just wish that I could still use the export function, it doesn't seem to work with windows 7 anymore.
Warning: AVIFILE will be removed in a future release. Use
> In avifile.avifile at 81
In anymate>AnimateToFile at 2003
In anymate>animation/ButtonSave at 1487
Warning: File 't1.818470283028525e-01.avi' not found.
> In anymate>animation/ButtonSave at 1495
Error using avifile (line 175)
Indeo codecs are not supported in this version of Windows.
Please specify a different codec.
See Mathworks Technical Solution 1-4G50RI for more

Error in avifile (line 175)

Error in anymate>AnimateToFile (line 2003)
avi=avifile(fn, 'compression',
anigetpref('AviCompression'), 'fps',

Error in anymate>animation/ButtonSave (line 1487)

Error while evaluating uipushtool ClickedCallback

Maybe you can update this to support more modern codecs, it would be highly appreciated!

Evgeny Pr

Evgeny Pr (view profile)

Evgeny Pr

Evgeny Pr (view profile)

Kelly Kearney

Kelly Kearney (view profile)

I've been having some difficulty with this function when trying to animate figures that include a large mix of object types, particularly ones with the same "type" value but different properties. For example, lines produced by line vs plot, hggroup objects of different types, etc. Anymate fails when trying to gather properties of these due to its reliance on a single sample handle from each type. An easy fix (or at least, easier than trying to handle every property gracefully) would be to have a switch to exclude certain properties from being collected (right now, excluding from anymation doesn't exclude from collection).




Ben (view profile)

A great function worthy 5 stars!


Bolu Ajiboye

Bolu Ajiboye (view profile)

This is an excellent submission. I wish i could give it 4.5 stars. Sorry to be the only one not to go for 5, but i have some issues, namely that some figures seem to get distorted when applied to anymate. Also, when you set the runmode and method from the function call, anymate doesnt seem to remember it. You have to do it again from the toolbar. Dont get me wrong, i love this function. It is one of the best i have seen on fileexchange, but some things dont work (for me anyways) as described.


Very helpfull

Husam Aldahiyat

Love this!


Andres (view profile)

What else to add, other than 5 stars? Helpful author, great idea, brilliant implementation, has proven usefulness many times... Thanks!

F Trintchouk

Very general, well thought out, robust and intuitive. Thank you!

Johannes Korsawe

This is a really, really ingenious submission.
Easy to handle, great options, excellent results.
Thank you for sharing this great job.

Gus Brown

This is really good, and it is ideal for Matlab beginners as it makes efficient animations very easy to create.

Kelly Kearney

This is a great tool. Well documented and easy to use. Very helpful when trying to visualize a large number of model runs with varying parameters.

Jiro Doke

Very nice! Here are a few things that I really like about this submission:
1. It interpolates (can choose between linear and spline-like) between "frames", which allows you to animate through only a few frames with transition. It works with images too.
2. It's a "mode" within a figure, so the interactive tools (zoom, pan) are still accessible.
3. Nice toolbar control buttons.
4. Good documentation. The published HTML files is very informative.
5. Can export to animated GIF or AVI.

John D'Errico

NIFTY. Ok, maybe this comment shows my age, but it definitely applies. Its well done in all respects. Everything I tried worked. Animations were simple to build.

I did manage to crash Matlab after too many animations. This was probably a Matlab/Java version bug, maybe even Mac related, probably memory related.

Well done.


Fixed mangled argument passing. Did not work for ticks and/or tick-labels on command line.

Titlebar could become invisible when the animation toolbar was added. Fixed.

Editorial changes to description. No changes to code.

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video