Main Content

数据类型

为信号和模块参数指定特定的数据类型,定义枚举

在模型中,用数据类型来确定信号与模块参数之间的交互方式。数值数据类型用来确定计算机如何在内存中存储信号和参数,以及计算机如何执行数学运算。其他 Simulink® 数据类型用来确定信号及参数的结构或允许的值。

要仿真计算机硬件的数学行为,或从模型中生成有效的代码,您可以控制信号和参数的数值数据类型。您可以指定浮点数、整数、定点和其他数值类型。请参阅 Simulink 支持的数据类型

枚举数据类型只允许信号和参数使用您指定的一组值。您可以通过为每个枚举值提供一个有意义的名称来提高模型的可读性。要在 Simulink 中使用枚举,请参阅在 Simulink 模型中使用枚举数据

您可以使用总线类型将多个信号或参数组合到一起,这样可以提高模型的可读性,而且便于维护模型。请参阅 使用总线对象指定总线属性

通过使用字符串类型,您可以轻松地在模型中使用字符串。

模块

全部展开

Block Support Table查看对 Simulink 模块的数据类型支持
Data Type Conversion将输入信号转换为指定的数据类型
Data Type Conversion Inherited使用继承的数据类型和定标将一种数据类型转换为另一种
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 String扫描输入字符串并转换为指定格式的信号
String Compare比较两个输入字符串
String Concatenate串联各个输入字符串以形成一个输出字符串。
String Constant输出指定的字符串
String ContainsDetermine if string contains, starts with, or ends with pattern (自 R2020a 起)
String CountCount occurrences of pattern in string (自 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 Double将字符串信号转换为双精度信号。
String to EnumInput string signal to enumerated signal
String to Single将字符串信号转换为单个信号
SubstringExtract substring from input string signal
To String将输入信号转换为字符串信号

函数

全部展开

enumeration类枚举成员和名称
Simulink.defineIntEnumType定义枚举数据类型
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
fixdt创建描述定点或浮点数据类型的 Simulink.NumericType 对象
fixpt_evenspace_cleanupModify breakpoints of lookup table to have even spacing
fixpt_look1_func_approx通过插入查找表数据点来优化非线性函数的定点逼近
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.importExternalCTypes生成由 C 或 C++ 代码定义的自定义数据类型的 Simulink 表示
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 (自 R2023a 起)

Simulink.AliasType为信号和参数数据类型创建别名
Simulink.NumericType指定浮点数、整数或定点数据类型

模型设置

全部展开

非规范数的仿真行为Emulate hardware handling of denormal numbers
使用针对行优先数组布局优化的算法Enable algorithm for row-major format code generation and simulation
数据类型未定时默认使用的类型Data type to use when Simulink cannot infer the data type
使用除法进行定点净斜率计算How net slope computations are performed when a change of fixed-point slope is not a power of two
增益参数继承无损的内置整数类型Parameter data type for Gain blocks that inherit via internal rule
使用浮点乘法处理净斜率校正Net slope correction computation for floating-point to fixed-point casts
继承小于单精度的浮点输出类型Inherited output data type behavior when block inputs are floating-point data types smaller than single precision (自 R2021a 起)
应用程序生命周期(天)Duration in days before timer overflow occurs
时钟分辨率Simulate target platform clock resolution (自 R2023a 起)
将逻辑信号实现为布尔数据(而不是双精度数据)Logic signal data type

主题

相关信息