Suppressing plots and creating movies

11 views (last 30 days)
William Thalheimer
William Thalheimer on 30 Jun 2011
[[UPDATE]] Found the link here, thanks to Paulo for putting me on the right path, this was a little more what I was looking for: http://www.mathworks.com/support/tech-notes/1200/1204.html#Section%2010
I'm writing a code to simulate star clusters. Currently I show the positions of the point-masses at each time step with the scatter3 function. So when I run the simulation I have to watch each of the thousands of frames as they are calculated. My ultimate goal is to save the frames to some sort of movie file so that I can view it in 30 seconds as opposed to the minutes it takes to simulate. I assume the simulation would be faster if MATLAB didnt have to output a plot at each time step and instead just saved each one to a file to create the movie at the end. So my question is two-fold:
1.) How do I suppress plot output so I dont need to watch the frames being generated? (or does suppressing output even speed up the process?)
2.) How can I save the frames to a universal movie file (like mpg or avi, not MATLAB)? I tried using mpgwrite but it seems out of date at least for the release of MATLAB that I'm using (2010b).
Thanks for the help!
Billy

Answers (2)

Jan
Jan on 30 Jun 2011
If you want to take pictures of your figures by GETFRAME, they must be visible. But you could save the calculated coordinates as a MAT file (or several MAT files) instead of showing them during the processing. I assume the actual creation of the graphics is very fast and most of the time is spend in the simulation.
I'm not happy with the quality of the MOVIE2AVI videos. Therefore I export GIFs and letthe freeware ImageMagick create an animated GIF. This has no compression atrifacts and takes less than 10% diskspace usually.

Paulo Silva
Paulo Silva on 30 Jun 2011
doc movie %see the examples, very detailed and simple
doc movie2avi

Categories

Find more on Animation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!