In models, data types determine the interactions between signals and block parameters. Numeric data types determine how a computer stores signals and parameters in memory and how a computer performs math operations. Other Simulink® data types determine the structure or allowed values of signals and parameters.
To simulate the mathematical behavior of computer hardware, or to generate efficient code from a model, you can control the numeric data types of signals and parameters. You can specify floating-point, integer, fixed-point, and other numeric types. See Data Types Supported by Simulink.
Enumerated data types allow signals and parameters to use only a set of values that you specify. You can improve model readability by providing a meaningful name for each enumerated value. To use enumerations in Simulink, see Use Enumerated Data in Simulink Models.
You can use bus types to group multiple signals or parameters together, which can improve model readability and ease model maintenance. See Data Types for Buses.
You can use string types to easily use strings in models.
|Block Support Table||View data type support for Simulink blocks|
|Data Type Conversion||Convert input signal to specified data type|
|Data Type Conversion Inherited||Convert from one data type to another using inherited data type and scaling|
|Data Type Duplicate||Force all inputs to same data type|
|Data Type Propagation||Set data type and scaling of propagated signal based on information from reference signals|
|Data Type Scaling Strip||Remove scaling and map to built in integer|
|ASCII to String||Uint8 vector signal to string signal|
|Compose String||Compose output string signal based on specified format and input signals|
|Scan String||Scan input string and convert to signals per specified format|
|String Compare||Compare two input strings|
|String Concatenate||Concatenate input strings to form one output string|
|String Constant||Output specified string|
|String Contains||Determine if string contains, starts with, or ends with pattern|
|String Count||Count occurrences of pattern in string|
|String Find||Return index of first occurrence of pattern string|
|String Length||Output number of characters in input string|
|String to ASCII||Convert string signal to uint8 vector|
|String to Double||Convert string signal to double signal|
|String to Enum||Input string signal to enumerated signal|
|String to Single||Convert string signal to single signal|
|Substring||Extract substring from input string signal|
|To String||Convert input signal to string signal|
|Class enumeration members and names|
|Define enumerated data type|
|Find enumeration classes defined by
|Delete enumeration classes defined by
|Get information about enumerated data type|
|Determine whether an enumeration class is valid for Simulink|
|Determine whether an enumeration object is valid for Simulink|
Numeric Data Types and Fixed Point
|Modify breakpoints of lookup table to have even spacing|
|Optimize fixed-point approximation of nonlinear function by interpolating lookup table data points|
|Plot fixed-point approximation function for lookup table|
|Set property for each fixed-point block in subsystem|
|Exponent that gives best precision for fixed-point representation of value|
|Determine maximum precision available for fixed-point representation of value|
|Generate Simulink representations of custom data types defined by C or C++ code|
|Create Simulink parameter objects from tunable parameters|
- Validate a Floating-Point Embedded Model
Use simulation to verify that a control algorithm can continue to meet application requirements while using single-precision floating-point data types.
- Control Data Types of Signals
Apply data types other than
doubleto signals in a model.
- Specify Fixed-Point Data Types
If you do not have Fixed-Point Designer™, you can still inspect and use fixed-point models that others share with you.
- Specify Data Types Using Data Type Assistant
Interactively apply data types, such as integer, fixed-point, and enumerated types, to data items in a model.
- Use Enumerated Data in Simulink Models
Create and use enumerations in Simulink models.
- Simulink Strings
Use strings in models.
- About Data Types in Simulink
Data items (signals, block parameters, and states) in a model have a data type, such as
int8, which determines how a computer represents the data in memory.
- Data Types Supported by Simulink
Simulink supports many floating-point, integer, fixed-point, Boolean, and other data types.
- Data Types for Buses
Specify a data type for an entire bus by creating a Simulink.Bus object. A bus is a single line that contains data for multiple individual lines.
- Simulink Enumerations
Enumerated data is data that is restricted to a finite set of values. Simulink models can use an enumeration as a data type.