Documentation

setModelParameter

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

Syntax

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

Description

example

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.

Examples

collapse all

This example modifies the model parameters of through the SimulationInput object

Open the model.

mdl = 'sldemo_househeat';
open_system(mdl);

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?