File Exchange

image thumbnail

ANIMATOR - animate data

version (359 KB) by jiro

jiro (view profile)

This GUI tool allows you to animate your data with controls for playback speed and looping.


Updated 01 Sep 2016

View License

Editor's Note: This was a File Exchange Pick of the Week

This GUI tool allows you to animate your data with controls for playback speed and looping.
The controls allows you to speed up and slow down (or reverse) the playback. You can pause at any time. You can also drag the time line bar to go to arbitrary frames. Also, use the arrow keys to move between frames (left or right) or change the speed (up or down). Spacebar pauses/starts the animation. In addition to the animation speed, the animation frame interval rate can be set from the menu.

The graphics properties can be customized via a context menu on the objects. Right-click on the plotted lines to bring up the context menu.

The animation can be exported to an AVI or an Animated GIF (from the menu).

ANIMATOR(X, Y) animates the data. The data has to be in one of the following formats. The general form is a 3-D array. 1st dimension is the numbe of elements in a signal (m). 2nd dimension is the number of lines (n). 3rd dimension is the number of frames (p).

ANIMATOR(X, Y, PARAM1, VALUE1, ...) accepts additional arguments:
'axis' : {'auto'}, 'equal
'xlim' : 'auto', [XMIN, XMAX].
'ylim' : 'auto', [YMIN, YMAX].
'title' : <title text>
'xlabel': <xlabel text>
'ylabel': <ylabel text>
'smooth': {'off'}, 'on'. Anti-aliasing

x = (0:.01:10)';
y = nan(length(x), 2, 400);
for idx = 1:400;
animator(x, y);

*NOTE 1* This uses the new MATLAB Class System, so it requires R2008a or newer.
*NOTE 2* Requires R2010b or newer to export to an AVI.
*NOTE 3* Requires Image Processing Toolbox to export to Animated GIF, if using R2008b or older. If you're not going to export to Animated GIF, you don't need Image Processing Toolbox.

Comments and Ratings (13)

Yee Jack

nice work!

Todd Mackey

Excellent. Was able to easily visualize polygons and scatter plots that change versus time. Was able to add a time string to the figure (rather than frame number). Would like the ability to zoom - not sure how to add that? Would also like to use an image as the background, not sure if that's even feasible?

Thanks for this!


S (view profile)

This is a great toolbox, works really well and is easy to use. I am having a couple of problems with it though.

1. My axis are all reversed and upside down... (my x values start negative and go to positive)
2. The export to gif and AVI features don't seem to work, I just get all the frames, but they just contain the menu items Extra -> Export to -> as if they are a screenshot.

I'm on R2012b, it doesn't display any other errors


this is an amazing toolbox...
but how can we define the colour of the curve, the shape of curve like 'b-', etc...
how to include another graphic option?


peter (view profile)

thanks a lot, Jiro


pink (view profile)

how to use

It is precfectly explained, plus the code is commented and very organized. Thanks a lot!


James (view profile)

Ahmet Mert

woow amazing! thanks

This is a great program. Very helpful!!!!! Thank you!!!

Harris Ahmed

Needs description of how to make it work

bibin mathew

Scott Hirsch

Brilliant! Jiro scores again.


Updated license

Updated to include an App file for R2012b.

Changed the implementation to use MATLAB classes. Added the ability to bring in data from the base workspace. Added the ability to interactively change the graphics properties via context menu.

Added capability to export to AVI and animated GIF (R14SP2 or later)

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor