Main Content

Specify Block Properties

For each block in a model, you can set general block properties, such as:

  • A description of the block

  • The block execution priority

  • A block annotation

  • Block callback functions

To set block properties, use the Property Inspector. You can set properties in the Properties and Info tabs of the Property Inspector when the block is selected. Alternatively, you can use the Block Properties dialog box.

Set Block Annotation Properties

In the Property Inspector, use the Block Annotation section to display the values of selected block parameters in an annotation. The annotation appears below the block icon.

Enter the text of the annotation in the text box. You can use a block property token in the annotation. The value for the property replaces the token in the annotation in the model. To display a list of tokens that you can use in an annotation, type % in the text box. The parameters that are valid for the selected block appear. See Common Block Properties and Block-Specific Parameters.

Suppose that you specify the following annotation text and tokens for a Product block:

Multiplication = %<Multiplication>
Sample time = %<SampleTime>

In the Simulink® Editor, the block displays this annotation:

You can also create block annotations programmatically. See Create Block Annotations Programmatically.

Specify Block Callbacks

Use the Callbacks section to specify block callbacks. Callbacks are MATLAB® commands that execute when a specific model action occurs, such as when you select or delete a block. For more information on callbacks, see Customize Model Behavior with Callbacks.

  1. Select the block whose callback you want to set.

  2. In Properties tab of the Property Inspector, in the Callbacks section, select the function that you want to assign the callback to. For example, select OpenFcn to specify a behavior for double-clicking a block.

  3. In the text box, enter the command that you want to execute when that block function occurs.

    After you assign a callback to a function, the function displays an asterisk next to it in the list. The asterisks helps you to see the functions that have callbacks assigned to them.


    After you add an OpenFcn callback to a block, double-clicking the block does not open the block dialog box. Also, the block parameters do not appear in the Property Inspector when the block is selected. To set the block parameters, select Block Parameters from the block context menu.

Set a Block Callback Programmatically

This example shows how to use the OpenFcn callback to execute MATLAB scripts when you double-click a block. For example, in a MATLAB script you can define variables or open a plot of simulated data.

To create a callback programmatically, select the block to which you want to add this property. Then, at the MATLAB command prompt, enter a command in this form:

In this example, myfunction represents a valid MATLAB command or a MATLAB script on your MATLAB search path.

Specify Block Execution Order, Execution Priority and Tag

In the block properties, you can specify the block execution order, execution priority and identify the block by assigning a value to the Tag property.

  • Execution Order— Specify execution order of blocks relative to other blocks. By default, blocks execute based on priority. You can use this property to designate blocks at the root level of a model or inside a nonvirtual subsystem to execute first or last relative to other blocks. You can set the block execution order through Block Properties dialog. In the Block Properties dialog, from the Execution Order list, select First or Last. For more information, see Set Execution Order Property for Block to Execute First.

    These blocks are not supported for Execution Order set to First or Last:

    For the first or last option in the block execution order property to work:

    • Only one block can be configured to execute first or last at a single level of model hierarchy. For example, if a Data Store Read block is set to execute first at the root-level model, another block cannot execute first at the root level of this model.

    • Connect only the Inport block to the input port of a block configured to execute first. However, there is no limitation on which block you can connect to the output port of such a block.

    • Connect only the Outport block to the output port of a block configured to execute last. However, there is no limitation on which block you can be connect to the input port of such a block.

    • Blocks cannot be in an algebraic loop. The algebraic loop solver must determine the execution order based on the algebraic variables in the loop, so specifying execution order for algebraic loops is not supported. For more information, see How the Algebraic Loop Solver Works.

    • Blocks must be inside a system that executes in a single task. For more information, see Control and Display Execution Order.

    These limitations apply to code generated from a model containing blocks set to execute first or last. In the generated code:

    • Execution order of the blocks being set to execute first or last may not be traceable due to optimization.

    • In some cases, Simulink may deem that an extra signal copy is needed before blocks set to execute first or after blocks set to execute last. For example, the software may add a copy of the output signal of a block set to execute last to the root Outport block after the block set to execute last executes.

  • Priority — Specify the execution priority of the block relative to other blocks. Specify a numerical value. A smaller number indicates a higher priority. This option is available only when the Execution Order is set to Based on priority. For more information, see Set Priority in Execution Order of Blocks.

  • Tag — Specify an identifier for the block. Specify text to assign to the block Tag property. Setting this property is useful for finding the block in the model by searching or programmatically using find_system. See Explore Model Hierarchy.


In determining execution priority, Simulink compares the Priority of blocks only to that of other blocks in the same block diagram, even if the block diagram is a virtual subsystem, and only to other blocks that have their Priority explicitly set.


Starting in R2024a, blocks with Execution Order set to First or Last is supported inside a model that contains blocks with continuous sample time.

Use Block Description to Identify a Block

The Info tab displays information about the block type. The block author provides this description.

You can also enter a description in the Description box to provide information about the block instance.

  • If you add a description, you can set up your model display so that the description appears in a tooltip when you hover over the block. To enable this tooltip, on the Debug tab, select Information Overlays > Description in Tooltip .

  • The Description property can help you to find a block by searching. See Simulink Editor.

Create Block Annotations Programmatically

You can use a block AttributesFormatString parameter to display specified block parameter values below the block. Common Block Properties and Block-Specific Parameters describe the parameters that a block can have. Use the Simulink set_param function to set this parameter to the attributes format that you want.

The attributes format can be any text that has embedded parameter names. An embedded parameter name is a parameter name preceded by %< and followed by >, for example, %<priority>. Simulink displays the attributes format text below the block icon, replacing each parameter name with the corresponding value. You can use line-feed characters (\n) to display each parameter on a separate line. For example, select a Gain block and enter this command at the MATLAB command prompt:


The Gain block displays this block annotation:

If a parameter value is not text or an integer, N/S (for not supported) appears in place of the value. If the parameter name is not valid, Simulink displays ??? in place of the value.

Related Topics