Main Content

Define Measurement Units for Masked Blocks

Measurement units translate the amount of entities supplied to your computations. They are also crucial when diverse users using different systems of measurement are using the same equation. You can add measuring units to a Simulink® model to enhance the usability and to avoid confusion while analyzing equations.

To specify measuring units for masked blocks, you can:

  • Promote a Unit parameter from the underlying block to the mask. For more information, see Promote Block Parameters on a Mask.

  • Add a Unit parameter to the mask dialog box as shown in the following steps:

    1. Open a Simulink Model.

    2. Select the block to be masked and press Ctrl+M. The Mask Editor opens.

    3. In the Mask Editor, click the Parameters & Dialog tab.

    4. In the Parameters section, click Unit.

    5. Click the Code tab in the Mask Editor dialog box.

    6. To define the measurement unit for the Unit parameter, specify the initialization command by using the following syntax:

      set_param([gcb '/<blockname>'], '<unit parameter name>', get_param(gcb, '<unit parameter name>'));

      For example, to associate the Unit parameter with the measuring unit of the Inport block, use:

      set_param([gcb '/In1'], 'Unit', get_param(gcb, 'Unit'));

Related Topics