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:
Open a Simulink Model.
Select the block to be masked and press Ctrl+M. The Mask Editor opens.
In the Mask Editor, click the Parameters & Dialog tab.
In the Parameters section, click Unit.
Click the Code tab in the Mask Editor dialog box.
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'));