applyToModel - Apply configuration in SimulationInput object to
model - MATLAB ([original](https://in.mathworks.com/help/simulink/slref/simulink.simulationinput.applytomodel.html)) ([raw](?raw))
Main Content
Apply configuration in SimulationInput
object to model
Syntax
Description
applyToModel([simin](#mw%5F670c7ffc-4639-4044-bd83-48a928709c3c))
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](#mw%5F670c7ffc-4639-4044-bd83-48a928709c3c),EnableConfigSetRefUpdate=[configupdate](#mw%5F676f8750-6c67-4bde-99d2-fed18aa458ca))
applies the configuration specified in the Simulink.SimulationInput
object simin
to the model specified in the object.
Examples
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
as75
. - Set the cost to 50 by specifying the value of the
cost
variable in the model workspace as50
. - 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.
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
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
See Also
Objects
Functions
- sim | parsim | batchsim | setBlockParameter | setModelParameter | setInitialState | setExternalInput | setVariable | validate | setPreSimFcn | setPostSimFcn | loadVariablesFromMATFile