Main Content

Set Priority and Initial Target for Block Variables

When you open the Initial Targets section of the block dialog box, it lists all the public variables specified in the underlying component file, along with priority, beginning (target) value, and unit. For example, if you add a Translational Spring block to your model, double-click it to open its dialog box, and then expand the Initial Targets section, it looks like this:

Expanding the widget for each of these variables shows the variable initialization priority, initial target value, and unit.

For details on these variables and their usage in the block equations, click the Source code link on the Description tab of the block dialog box to view the underlying Simscape™ source file.


The Source code link is available for all the Foundation library blocks that have Initial Targets settings. Blocks from the add-on products, like Simscape Electrical™ or Simscape Fluids™, do not have a Source code link in the block dialog box. See the block reference page for information on relevant equations and specific initialization considerations.

To specify the initial deformation of the spring, select the check box next to the Deformation variable, to indicate that you are overriding the default values. Select the initialization priority for the variable, by setting its Priority drop-down to High, Low, or None. Type a new number into the Value field and change the unit, if desired. The unit drop-down lists contains all the units defined in the unit registry that are commensurate with the one specified in the variable declaration. In the following dialog box, Deformation is specified as a high-priority variable with the initial target of 20 mm.

If you clear the check box next to a variable name, its Priority and Value fields switch back to defaults specified in the component file. However, if you select the check box again, these fields will retain their last specified value for when they were overridden.


The variables included in the Initial Targets settings are run-time configurable by default. You can tune a block-level variable-initialization target value between simulation runs if you specify the target value using a variable that you save to the MATLAB® workspace.

For more information, see Run-Time Configurability for Block-Level Variable Initialization Target Values.

Related Topics