Main Content

Data Types

Assign specific data types to signals and block parameters; define enumerations

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 Specify Bus Properties with Bus Objects.

You can use string types to easily use strings in models.

Blocks

expand all

Block Support TableView data type support for Simulink blocks
Data Type ConversionConvert input signal to specified data type
Data Type Conversion InheritedConvert from one data type to another using inherited data type and scaling
Data Type DuplicateForce all inputs to same data type
Data Type PropagationSet data type and scaling of propagated signal based on information from reference signals
Data Type Scaling StripRemove scaling and map to built in integer
ASCII to StringUint8 vector signal to string signal
Compose StringCompose output string signal based on specified format and input signals
Scan StringScan input string and convert to signals per specified format
String CompareCompare two input strings
String ConcatenateConcatenate input strings to form one output string
String ConstantOutput specified string
String ContainsDetermine if string contains, starts with, or ends with pattern (Since R2020a)
String CountCount occurrences of pattern in string (Since R2020a)
String FindReturn index of first occurrence of pattern string
String LengthOutput number of characters in input string
String to ASCIIConvert string signal to uint8 vector
String to DoubleConvert string signal to double signal
String to EnumInput string signal to enumerated signal
String to SingleConvert string signal to single signal
SubstringExtract substring from input string signal
To StringConvert input signal to string signal

Functions

expand all

enumerationClass enumeration members and names
Simulink.defineIntEnumTypeDefine enumerated data type
Simulink.findIntEnumTypeFind enumeration classes defined by Simulink.defineIntEnumType
Simulink.clearIntEnumTypeDelete enumeration classes defined by Simulink.defineIntEnumType
Simulink.data.getEnumTypeInfoGet information about enumerated data type
Simulink.data.isSupportedEnumClassDetermine whether an enumeration class is valid for Simulink
Simulink.data.isSupportedEnumObjectDetermine whether an enumeration object is valid for Simulink
fixdtCreate Simulink.NumericType object describing a fixed-point or floating-point data type
fixpt_evenspace_cleanupModify breakpoints of lookup table to have even spacing
fixpt_look1_func_approxOptimize fixed-point approximation of nonlinear function by interpolating lookup table data points
fixpt_look1_func_plotPlot fixed-point approximation function for lookup table
fixpt_set_allSet property for each fixed-point block in subsystem
fixptbestexpExponent that gives best precision for fixed-point representation of value
fixptbestprecDetermine maximum precision available for fixed-point representation of value
Simulink.importExternalCTypesGenerate Simulink representations of custom data types defined by C or C++ code
tunablevars2parameterobjectsCreate Simulink parameter objects from tunable parameters
stringtypeCreate string data type
showblockdatatypetableDisplay HTML page of Simulink block data type support
Simulink.Block.getInternalDataTypeGet data type of block parameter (Since R2023a)

Classes

Simulink.AliasTypeCreate alias for signal and parameter data type
Simulink.NumericTypeSpecify floating-point, integer, or fixed-point data type

Model Settings

expand all

Simulation behavior for denormal numbersEmulate hardware handling of denormal numbers
Use algorithms optimized for row-major array layoutEnable algorithm for row-major format code generation and simulation
Default for underspecified data typeData type to use when Simulink cannot infer the data type
Use division for fixed-point net slope computationHow net slope computations are performed when a change of fixed-point slope is not a power of two
Gain parameters inherit a built-in integer type that is losslessParameter data type for Gain blocks that inherit via internal rule
Use floating-point multiplication to handle net slope correctionsNet slope correction computation for floating-point to fixed-point casts
Inherit floating-point output type smaller than single precisionInherited output data type behavior when block inputs are floating-point data types smaller than single precision (Since R2021a)
Application lifespan (days)Duration in days before timer overflow occurs
Clock resolutionSimulate target platform clock resolution (Since R2023a)
Implement logic signals as Boolean data (vs. double)Logic signal data type

Topics

Related Information

Featured Examples