Hey Alden,
I understand that you want to use button to toggle the visibility (open or close) of scope in a Simulink model.
You can use a button to open or close the scope window by following the below steps:
- Add a ‘Push Button’ block from the Simulink Library Browser (Simulink/Dashboard).
- Right click the “Push Button” block and click properties.
- In the Porperties console, click on the callback tab.
- Configure a callback for the Button Block under “OpneFcn” Callback using the following code snippet:
if strcmp(get_param(uModel_name/Scopet, tOpeno), noni)
set_param(‘Model_name/Scope’, ‘Open’, ‘off’);
set_param(‘Model_name/Scope’ , ‘Open’, ‘on’);
Using this you can achieve the desired functionality. Enclosed is a screenshot of the attached model, which you can use for your reference:
Hope this helps.