MATLAB: Do I get a warning about under-specified data types in the Simulink model

simulink

If I set the 'Underspecified Data Types' Data Validity diagnostic to warning or error, my model generates a warning or error. I do not understand why my data types are underspecified.

Best Answer

When signal and parameter data types are not explicitly defined, Simulink tries to make a best guess as to what the signal's data types should be based upon the information in the model. In certain cases where there is a loop in which a block's input's informs its outputs and there is not enough data specified, Simulink is unable to confidently say what the appropriate data type should be. In this case, it assigns the data type to be a default data type.
Setting this diagnostic to "warning" will cause Simulink to display what blocks are the cause of the issue in the warning message.
Once the problem blocks are identified, the issue is easy to fix by:
  • Explicitly setting the data type anwhere in the path, using the block's Signal Data Types tab
  • Selecting the Sum/ Selector block's 'Require all inputs to have the same data type' option.
  • Or, using a Signal Specification block in the loop.