Main Content

Converting Units

Simulink® can convert units between ports when it detects discrepancies that have known mathematical relationships such as:

  • Scaling factors

  • Conversion factors and offsets, such as °F (Fahrenheit) to °C (Celsius)

  • Scaled, inverse units, such as mpg (miles per gallon) and L/km (liters per kilometer).

For example, if you connect one port with a unit of cm to one with a unit of mm, Simulink can automatically scale one unit to work with the other.

To enable Simulink to convert unit mismatches in your model automatically, select the Allow automatic unit conversions configuration parameter.

  • When Simulink successfully converts signal units at a block port, it displays .

  • When Simulink detects that an automatic conversion is not possible, it displays .

To manually convert units separated by a conversion factor or offset:

  1. Clear the Allow automatic unit conversions configuration parameter.

  2. Insert a Unit Conversion block between the ports whose units you want to convert.

Tip

Automatic conversion of units is a convenience. For better control of units, when Simulink detects a mismatch, consider modifying the units specified at one or the other of the two connected ports.

Automatic Unit Conversion Limitations

Simulink does not support automatic conversion:

  • At the root level of models configured for concurrent execution or export-function models. For more information, see Configure Your Model for Concurrent Execution and Export-Function Models Overview.

  • For fixed-point and integer signals.

  • At an input port of a Merge block.

  • At any port of an asynchronous Rate Transition block.

  • At an input port of a function-call subsystem.

  • For bus signals.

See Also

Blocks

Objects

Related Topics