- Create a variant subsystem and include the protected models for both the “RK4” and “Euler” solvers.
- Select the variant subsystem and access the "Block Parameters" dialog.
- In the "Variant Choices" section, choose the "RK4" model and set the "Variant control expression" field to “(get_param(gcs, 'Solver')=="ode4")”. This expression will check if the solver selected in the simulation pane is set to "ode4" (Runge-Kutta). Similarly, set the condition for "Euler" model.
- Save and close the variant subsystem.
- https://www.mathworks.com/help/simulink/slref/get_param.html
- https://www.mathworks.com/help/simulink/ug/variant-subsystems.html