MATLAB: How to set a configuration parameter using the SIM function in Simulink 7.6 (R2010b)

simulink

I would like to set the parameters used with the SIM function to simulate a model in Simulink.
For example, I would like to set parameters like 'MaxStep', 'MinStep' or 'StopTime'

Best Answer

In order to list all the properties that are listed under the configuration settings for a model in Simulink, you can use an object of the 'Simulink.ConfigSet' class in MATLAB. For example:
a = Simulink.ConfigSet;
a.Components(1);
In order to change the 'MaxStep', 'MinStep' or 'StopTime' for a given simulation run of a model, you can use the following syntax:
simOut = sim('vdp','SimulationMode','normal', 'MaxStep', '1e-5', 'StopTime', '30');
NOTE: "VDP" is an example model that is available in Simulink for reference. In order to open the model, you can type 'vdp' on your MATLAB command line.