| Contents | Index |
| On this page… |
|---|
Compressing Animation Recordings |
As the SimMechanics visualization window displays the body motion, you can capture what you see as a recording and save it. This section explains how to record animations. See the preceding section, Controlling Animation, for more about animation.
If you record an animation, the recording captures each updated, displayed simulation scene as a frame.
Whatever you see in the animated display window, is what the recording captures, as closely as it can within the limitations of the format.
When you record an animation from the window, it is stored as a file on your system in Audio Video Interleave (AVI) format.
Caution Recording an animation overwrites any existing file with the same name as the AVI file in the same folder. The AVI file write fails if a file of the same name that is locked by another application exists in the same folder. |
You can activate animation recording by clicking the Store Animation in AVI File button on the toolbar. The default is deactivated.
If you activate, the AVI File Location file browser opens, as discussed next.
You control recording settings using the Simulation menu.
You can specify a location and name for your AVI file recording by selecting Choose AVI File Location from the Simulation menu. If you activate recording, an AVI File Location file browser opens and requires you to select a location and specify an AVI name. The default AVI name for a model called modelname.mdl is modelname.avi, but you can change this default name. Click Save to complete the AVI file specification.
When you activate recording, this AVI file name appears in the bottom middle of the full visualization window, below the display, in the status bar.
If you cancel the file browser, the recording is canceled as well.

The simulation first records a MATLAB movie by capturing the display at every visualization sample time step. Then, in the termination phase of your simulation, it converts this movie to AVI format and stores it in the AVI file. A small AVI Conversion window opens to indicate that conversion and storage are complete and to display the path of the AVI file. Click OK to close this prompt.
You can reduce the size of your AVI file by compressing it. Select Compress AVI File to activate this feature. The default is active.
AVI compression is available only on the Windows® platform. MATLAB uses the Indeo 5 compression algorithm. You must have the corresponding video codec installed to
Compress an animation while recording.
Decompress and play back a compressed animation recording.
Check your operating system configuration for installed video codecs.
Caution You must have the Indeo 5 video codec installed to compress an animation recording. If you do not have this codec installed, animation and recording proceed, but with compression deactivated. |
Any technique that reduces the number of visualization samplings and updates reduces the total stream of animated frames and the size of the recorded file. See Controlling Animation preceding.
Tip If MATLAB runs out of memory while recording an animation, you will receive a warning. The simulation continues until completion, but recording is truncated at the simulation time when memory was exhausted. Use one of the techniques discussed to reduce the total stream of animated frames and attempt the recording again. The simplest technique is to skip frames. |
You need an AVI-compatible video player to view the recorded file. You can use the internal MATLAB movie viewer or an external video player.
Caution You must have the Indeo 5 video codec installed to decompress and play back a compressed animation recording. |
Your computer will play back an AVI animation recording at 15 frames per second of real (clock) time, regardless of the simulation speed or visualization sample time during recording.
To guarantee that the animation playback show the simulation in real (clock) time, before recording, set:
The model output sample time to be 1/15th of a second.
The visualization sample time to be equal to or less than the model output sample time.
See Changing How the Animation Is Updated preceding for more about sample times.
![]() | Controlling Animation | SimMechanics Visualization Menus and Their Controls | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |