MATLAB: Programatically change state of slider switch

set_paramsimulink dashboardslider switch

I am using a slider switch from the Simulink Dashboard library.
Can I change its state to "off" with a Matlab script using set_param?
So far I have been unable to find a relevant parameter with get_param (gcb,'ObjectParameters').
This must be the first Matlab question I've asked in about 4 years. Really stumped on this one :/

Best Answer

Found a solution using set_param and atatched an example simulink model (This one is hard to explain in words but reading the model conveys teh concept more clearly). My attempt at a concise solution follows..
The simulink dashboard objects reference the value a signal somewhere in your simulink model.
My dashboard switch is referencing the value in a "constant" block which represents an on/off switch for the system.
I then have an output from my system describing the on/off state. If a falling edge is detected on that signal, we can detect that the system has turned itself off.
It is then possible to use a triggered subsystem with Matlab function block in it to call the set_param function. That function can set the value of the constant block which the dashboard switch is referencing.
I have attached an example system that turns itself off after it has been on for three seconds and deactivates the on/off switch.