Main Content

Underspecified data types

Diagnostic action to take if the software is unable to infer signal data type

Model Configuration Pane: Diagnostics / Data Validity

Description

The Underspecified data types parameter specifies the diagnostic action to take if the software is unable to infer the data type of a signal during data type propagation.

Settings

none (default) | warning | error
none

The software does not issue a diagnostic if it is unable to infer the data type of a signal during data type propagation.

warning

The software issues a warning if it is unable to infer the data type of a signal during data type propagation.

error

The software issues an error and terminates the simulation if the software is unable to determine the data type of a signal during data type propagation.

Examples

expand all

This example shows how to use the configuration parameter Underspecified data types to identify and resolve an underspecified data type.

  1. Open the example model UnderspecifiedDataTypes.

  2. Set the Underspecified data types configuration parameter to warning.

  3. Update the diagram. The signals in the model use the data type uint8, and the model generates a warning.

  4. Open the Diagnostic Viewer. The warning indicates that the output signal of the Constant block has an underspecified data type.

  5. Open the Constant block dialog box. On the Signal Attributes tab, Output data type is set to Inherit: Inherit via back propagation. The Constant block output inherits a data type from the destination block. In this case, the destination is the Sum block.

  6. Open the Sum block dialog box. On the Signal Attributes tab, Accumulator data type is set to Inherit: Inherit via internal rule. Sum blocks cast all of their input signals to the selected accumulator data type. In this case, the accumulator data type is specified as an inherited type.

  7. Open the Inport block dialog box. On the Signal Attributes tab, Data type is set to uint8.

The data type of the Constant block output signal is underspecified because the source and destination blocks each apply an inherited data type. The signal cannot identify an explicit data type to inherit. In cases like this, Simulink applies heuristic rules to select a data type to use.

To resolve the underspecified data type, you can use one of these techniques:

  • On the Signal Attributes tab of the Constant block dialog box, specify Output data type as a particular numeric type, such as uint8.

  • On the Signal Attributes tab of the Sum block dialog box, select the check box Require all inputs to have the same data type. With this setting, the Sum block applies the data type of the first input, uint8, to the underspecified data type of the second input.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

Programmatic Use

Parameter: UnderSpecifiedDataTypeMsg
Type: string | character vector
Value: "none" | "warning" | "error"
Default: "none"

Version History

Introduced before R2006a