Syncing up Video to Datafile for Animated plot

Animate a videofile + x,y plot for presentation / data exploration purposes
Updated 9 Dec 2013

View License

based on a few inputs:

-data file
-video file
-data acquisition rate
-frame nr. of the input video that corresponds to first datapoint

this script will output the original video (on the left) and in addition will display an animated version of the x,y plot (on the right).


-lets you specify the size of the image relative to the size of the plot
-specify the margins
-lets you rotate the video
-lets you crop to the part of the video you're interested in

Due to the way one makes animated plots in MATLAB - the resolution of the output video will depend on your screen resolution. However, this script is made so that it runs on both Mac OS X and windows, and should work for arbitrary screen resolutions.

For getting a good result one still might need a to fiddle a bit with the exact position of the x/ylabels, but at least one won't have to start from scratch. Let me know if you have suggestions to improve performance / usefulness.

Cite As

Peter Dieleman (2024). Syncing up Video to Datafile for Animated plot (, MATLAB Central File Exchange. Retrieved .

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes