Embed SimMechanics Visualization in MATLAB GUI

2 Ansichten (letzte 30 Tage)
Brian Munguia
Brian Munguia am 20 Jul. 2012
Beantwortet: Steve Miller am 8 Mär. 2018
I have a MATLAB GUI that will run a SimMechanics model and would like to embed the visualization window in the GUI. Is there any way to do this? I have seen people suggest saving the visualization as an avi file, which wouldn't allow for interaction (which would be ideal), but I'll take what I can get. If that is the only way, is there any way to automatically save a visualization as an avi file? I know there is a setting in the Simulation menu for 1st Gen SimMechanics, but I am running 2nd Gen and there doesn't seem to be any such setting. If there isn't, is there any way to save the visualization from the command window? And from there, how would I be able to run the avi animation on the axes?

Antworten (1)

Steve Miller
Steve Miller am 8 Mär. 2018
I do not believe there is a way to embed the Mechanics Explorer in a MATLAB GUI. You can, however, dock the Mechanics Explorer in the MATLAB desktop, which will give you the same effect.
You can generate videos from the Mechanics Explorer from the command line using the command smwritevideo
To control the viewpoint of your video, 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.
--Steve

Kategorien

Mehr zu Simulation and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by