Is there a way to disable the visualization of a Simscape Multibody simulation in the Mechanics Explorer using a command?

조회 수: 34 (최근 30일)
When I want to switch off the visualization of a Simscape Multibody simulation, I have to uncheck the box "Open Mechanics Explorer on model update or simulation". I want to do that using a command or a parameter, so that I don't have to open Simulink and check or uncheck the box.
The only solution I found so far is to create a copy of my Configuration Parameter Set where the visualization is turned off and switch to the different Configuration Parameter Set by
setActiveConfigSet('mymodel', 'Copy_of_Configuration1_without_visualization')
This works, but the problem here is that this changes the .slx file everytime I do that which is not really convenient, especially when working with git.

채택된 답변

Brian Hong
Brian Hong 2020년 5월 1일
You can use a set_param command.
>> set_param(<model name>,'SimMechanicsOpenEditorOnUpdate','off')
  댓글 수: 2
Katrin_S
Katrin_S 2020년 5월 4일
Thank you for your answer. This indeed seems to be the best way to do it.
This command, however, changes the .slx file. So even when you for example switch back the settings at the end of your script, the .slx file will still have changed. The way I handle it is to make sure that I don't save the changes when I close the model in order to avoid git from noticing a changed the file. This solution is not really satisfying, but there seems to be no way to disable the visualization in the Mechanics Explorer temporarily without changing the configuration set and thus the slx file.
Brian Hong
Brian Hong 2020년 5월 4일
You could try not saving the model as in this example
or using the sim command with the model parameter
>> paramNameValStruct.SimMechanicsOpenEditorOnUpdate = 'off';
>> simOut = sim(<model name>,paramNameValStruct)
to avoid changing the SLX.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simscape에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by