Set model parameters to be used for a specific simulation through SimulationInput object, in


in = in.setModelParameter(ParameterName,Value,...ParameterNameN,ValueN)



in = in.setModelParameter(ParameterName,Value,...ParameterNameN,ValueN) sets a model parameter Name with a Value. You can add multiple model parameters to the model using the same SimulationInput object. For more information on model parameters, see Model Parameters.


collapse all

This example modifies the model parameters of through the SimulationInput object

Open the model.

mdl = 'sldemo_househeat';

Create a SimulationInput object for this model.

in = Simulink.SimulationInput(mdl);

Modify model parameters.

in = in.setModelParameter('StartTime','1','StopTime','4');

Simulate the model.

out = sim(in)

Input Arguments

collapse all

Specify optional comma-separated pairs of ParameterName,Value arguments. ParameterName is the parameter name and Value is the corresponding value. ParameterName must appear inside single quotes (' '). Model parameter values are typically specified as character vectors. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN. ParameterNameN,ValueN pairs follow the same syntax as set_param.

Example: 'StartTime','1'

Introduced in R2017a

Was this topic helpful?