I made a system with a switch but also a if action block. The behavior of both systems should be the same. The switch doesn't work and the if action block doesn't reset. I am expecting the same output as the input.
double click the output port in the if-action subsystem and do the following: (a) set the Initial Output to 0. (b) Set "Output when disabled" to "reset".
Unfortunately unless you call 'set_param' the value of the variable will not be re-evaluated. Therefore calling 'set_param' is the way to do this. I would however recommend you find a way of doing this in Simulink instead, either via switches, or Stateflow if necessary, thereby avoiding the need for an event handler altogether.
Best Answer