필터 지우기
필터 지우기

Embed SimMechanics Visualization in MATLAB GUI

조회 수: 13 (최근 30일)
Brian Munguia
Brian Munguia 2012년 7월 20일
답변: Steve Miller 2018년 3월 8일
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?

답변 (1개)

Steve Miller
Steve Miller 2018년 3월 8일
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

카테고리

Help CenterFile Exchange에서 Simulation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by