Blocks
Customize block behavior by setting block parameters
To create a Simulink® model, you add blocks to a block diagram, and then connect and configure those blocks. You can assign values to numeric block parameters, which control block calculations during simulation, and adjust block properties, which control appearance.
Adjust the parameters and properties of blocks to:
Experiment with parameter values as you design a model.
Match simulation results with measured data by estimating parameter values.
Design an efficient control algorithm by optimizing parameter values.
Document blocks and customize appearance.
Define system constants by creating global variables that you can share between blocks and models.
Functions
Classes
Simulink.DualScaledParameter | Specify name, value, units, and other properties of Simulink dual-scaled parameter |
Simulink.Parameter | Store, share, and configure parameter values |
Simulink.VariantControl | Create a variant control variable object (Since R2021a) |
Simulink.VariantVariable | Create variant parameter object (Since R2021a) |
Topics
Block Parameters
- Set Block Parameter Values
Blocks have numeric parameters that determine how they calculate output values. To control the calculations that blocks perform, you can specify parameter values. - Share and Reuse Block Parameter Values by Creating Variables
To set multiple block parameters to the same value, you can use a numeric variable that you create and store in a workspace such as the base workspace, a model workspace, or a data dictionary. - Use Variant Parameters to Reuse Block Parameters with Different Values
Design one model for many variants of a system that differ in block parameter values. - Parameter Interfaces for Reusable Components
For each block parameter in a reusable component, specify the same value for all instances of the component or a different value for each instance. - Organize Related Block Parameter Definitions in Structures
Increase model readability and reduce the effort of model maintenance by aggregating block parameter values into structures. - Tune and Experiment with Block Parameter Values
As you construct a model you can experiment with block parameters, such as the coefficients of a Transfer Fcn block, to help you decide which blocks to use. - Optimize, Estimate, and Sweep Block Parameter Values
Use parameter sweeping to tune control parameters, estimate unknown model parameters, and test the robustness of a control algorithm by taking into consideration uncertainty in the real-world system. - Switch Between Sets of Parameter Values During Simulation and Code Execution
Switch between independent sets of values for the same block parameters by storing the sets in an array of structures. - Control Block Parameter Data Types
Control the data type that Simulink and the generated code use to store block parameter values in computer memory. - Specify Minimum and Maximum Values for Block Parameters
Fully specify your design and optimize the generated code by setting minimum and maximum values for numeric block parameters. - Programmatically Specify Block Parameters and Properties
To write scripts that modify block behavior, determine the programmatic names and supported values of block parameters and properties.
Block Properties
- Specify Block Properties
Control block appearance and add custom documentation to blocks. Specify block execution priority and callbacks. - Specify Blocks to Execute First or Last
Specify block execution order. - Associating User Data with Blocks
Associate your own data, such as a numeric variable, with a block.