MATLAB Answers

Animating SimMechanics 3D Output

1 view (last 30 days)
Daniel Kluk
Daniel Kluk on 11 Nov 2011
Answered: Steve Miller on 9 Mar 2018
I am trying to save my SimMecahanics visualization output to an AVI file, but I am running into a few problems. The biggest one is that it doesn't seem to be able to create movies larger than about 500 frames before I get an "out of memory" message. Is there any way to fix this other than upgrading the memory in my machine?
Second, when I view the resulting AVI file, it "blacks out" every few frames; i.e. playback proceeds normally for several frames, and then the window goes black for a fraction of a second. The quality is very poor; not something I'd want to present to a client.
Any advice?

Answers (1)

Steve Miller
Steve Miller on 9 Mar 2018
Video generation technology has advanced quite a bit in recent releases, so I recommend trying it again. You can define cameras within the Mechanics Explorer. The location and orientation of the camera can change during the animation of the simulation results, and those results can be exported to a video.
See Camera Manager in the documentation.
Below is an example of an animation exported from the Simscape Multibody Mechanics Explorer with a dynamic camera. The camera can also be configured to track the box, always keeping it in the center of the frame. This example is available on the File Exchange: Robot Arm with Conveyor Belts.

Community Treasure Hunt

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

Start Hunting!