Main Content


Get parameterization of tuned block in slTuner interface


getBlockParam lets you retrieve the current parameterization of a tuned block in an slTuner interface.

An slTuner interface parameterizes each tuned Simulink® block as a Control Design Block, or a generalized parametric model of type genmat or genss. This parameterization specifies the tuned variablesTuned Variables for commands such as systune.


blk_param = getBlockParam(st,blk) returns the parameterization used to tune the Simulink block, blk.


[blk_param1,...,blk_paramN] = getBlockParam(st,blk1,...,blkN) returns the parameterizations of one or more specified blocks.


S = getBlockParam(st) returns a structure containing the parameterizations of all the tuned blocks of st.


collapse all

Create an slTuner interface for the scdcascade model.

st = slTuner('scdcascade',{'C1','C2'});

Examine the block parameterization of one of the tuned blocks.

blk_param = getBlockParam(st,'C1')
Tunable continuous-time PID controller "C1" with formula:

  Kp + Ki * ---

and tunable parameters Kp, Ki.

Type "pid(blk_param)" to see the current value.

The block C1 is a PID Controller block. Therefore, its parameterization in st is a tunablePID Control Design Block.

Create an slTuner interface for the scdhelicopter model.

st = slTuner('scdhelicopter',{'PI1','PI2','PI3','SOF'});

Retrieve the parameterizations for the PI controllers in the model.

[parPI1,parPI2,parPI3] = getBlockParam(st,'PI1','PI2','PI3');

Create an slTuner interface for the scdcascade model.

st = slTuner('scdcascade',{'C1','C2'});

Retrieve the parameterizations for both tuned blocks in st.

blockParams = getBlockParam(st)
blockParams = 

  struct with fields:

    C1: [1x1 tunablePID]
    C2: [1x1 tunablePID]

blockParams is a structure with field names corresponding to the names of the tunable blocks in st. The field values of blockParams are tunablePID models, because C1 and C2 are both PID Controller blocks.

Input Arguments

collapse all

Interface for tuning control systems modeled in Simulink, specified as an slTuner interface.

Block in the list of tuned blocks for st, specified as a character vector or string. You can specify the full block path or any portion of the block path that uniquely identifies the block among the other tuned blocks of st.

Example: blk = 'scdcascade/C1', blk = "C1"

Output Arguments

collapse all

Parameterization of the specified tuned block, returned as one of the following:

Parameterization of all tuned blocks in st, returned as a structure. The field names in S are the names of the tuned blocks in st, and the corresponding field values are block parameterizations as described in blk_param.

More About

collapse all

Tuned Blocks

Tuned blocks, used by the slTuner interface, identify blocks in a Simulink model whose parameters are to be tuned to satisfy tuning goals. You can tune most Simulink blocks that represent linear elements such as gains, transfer functions, or state-space models. (For the complete list of blocks that support tuning, see How Tuned Simulink Blocks Are Parameterized). You can also tune more complex blocks such as SubSystem or S-Function blocks by specifying an equivalent tunable linear model.

Use tuning commands such as systune to tune the parameters of tuned blocks.

You must specify tuned blocks (for example, C1 and C2) when you create an slTuner interface.

st = slTuner('scdcascade',{'C1','C2'})

You can modify the list of tuned blocks using addBlock and removeBlock.

To interact with the tuned blocks use:

Tuned Variables

Within an slTuner interface, tuned variables are any Control Design Blocks involved in the parameterization of a tuned Simulink block, either directly or through a generalized parametric model. Tuned variables are the parameters manipulated by tuning commands such as systune.

For Simulink blocks parameterized by a generalized model or a tunable surface:

  • getBlockValue provides access to the overall value of the block parameterization. To access the values of the tuned variables within the block parameterization, use getTunedValue.

  • setBlockValue cannot be used to modify the block value. To modify the values of tuned variables within the block parameterization, use setTunedValue.

For Simulink blocks parameterized by a Control Design Block, the block itself is the tuned variable. To modify the block value, you can use either setBlockValue or setTunedValue. Similarly, you can retrieve the block value using either getBlockValue or getTunedValue.

Version History

Introduced in R2011b