Main Content


Apply configuration in SimulationIntput object to model



applyToModel(simin) applies the configuration specified on the Simulink.SimulationInput object simin to the model specified in the object. Use this function to debug or interactively analyze a simulation.

applyToModel(simin,EnableConfigSetRefUpdate=configupdate) applies the configuration specified in the Simulink.SimulationInput object simin to the model specified in the object.


collapse all

Create a Simulink.SimulationInput object to configure a simulation of the model sldemo_househeat.

mdl = "sldemo_househeat";
simin = Simulink.SimulationInput(mdl);

Specify these values on the SimulationInput object:

  • Set the thermostat set point to 75 by specifying the value of the Constant block named Set Point as 75.

  • Set the cost to 50 by specifying the value of the cost variable in the model workspace as 50.

  • Specify the simulation start time as 1 and the simulation stop time as 5.

blkpath = mdl + "/Set Point";
simin = setBlockParameter(simin,blkpath,"Value","75");
simin = setVariable(simin,"cost",50,Workspace="sldemo_househeat");
simin = setModelParameter(simin,StartTime="1",StopTime="5");

Simulate the model sldemo_househeat using the configuration stored in the SimulationInput object.

out = sim(simin);

Suppose you want to further analyze the simulation based on the results from the programmatic simulation. To apply the configuration in the SimulationInput object to the model, use the applyToModel function.


To view the model in the Simulink Editor, open the model. The asterisk in the title bar indicates that the model has been modified, in this case by the call to the applyToModel function.


Input Arguments

collapse all

Simulation inputs and configuration, specified as a Simulink.SimulationInput object.

Specify EnableConfigSetRefUpdate flag to "on" to apply the ConfigSetRefs settings to the Simulink.SimulationInput object, for the model that uses reference configuration sets.

Version History

Introduced in R2017a