Documentation

setBlockParameter

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

Syntax

in = in.setBlockParameter(BlockPath,ParameterName,Value,...ParameterNameN,ValueN)

Description

example

in = in.setBlockParameter(BlockPath,ParameterName,Value,...ParameterNameN,ValueN) sets the parameter on the block specified at BlockPath with the properties ParameterName and Value. You can set multiple block parameters in a model using the same SimulationInput object. For more information on block parameter, see Block-Specific Parameters.

Examples

collapse all

This example modifies the block parameters of a model 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 block parameter.

in = in.setBlockParameter('sldemo_househeat/Set Point','Value','300');

Simulate the model.

out = sim(in)

Input Arguments

collapse all

BlockPath is the path of the block for which the parameter is changed

Example: 'sldemo_househeat/Set Point'

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 (' '). Block 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: 'Value', '350'

Introduced in R2017a

Was this topic helpful?