Main Content

金宝appsimulink.Airstype

Create alias for signal and parameter data type

Description

Use a金宝appsimulink.Airstype创建一个内置数据类型的别名,例如int8

这name of the object is the alias. The data type to which an alias refers, such asint8,,,,is the base type. Alias names cannot be:

  • 浮点类型:一半,,,,单身的,,,,double

  • Integer types:int8,,,,UINT8,,,,int16,,,,uint16,,,,int32,,,,UINT32,,,,int64, 或者Uint64

  • Fixed-Point Designer™ types beginning withsfix,,,,ufix, 或者flt

你在基地工作区中创建对象或data dictionary. To use the alias, you use the name of the object to set data types for signals, states, and parameters in a model.

使用别名来指定信号和参数数据类型可以极大地简化模型指定数据类型的全局更改。特别是,更改所有信号,状态和参数的数据类型的数据类型是由别名指定的,仅需要更改别名的基本类型。相比之下,更改数据类型的信号,状态和参数的数据类型是由实际类型名称指定的,需要分别对每个信号和参数的数据类型进行重新定义。

您可以使用此类的对象为Simulink创建一个别名金宝app®built-in data types, fixed-point data types, enumerated data types,金宝appsimulink.numerictypeobjects, and other金宝appsimulink.Airstypeobjects. The code that you generate from a model (Simulink Coder™)uses the alias only if you use an ERT-based system target file (Embedded Coder®)。

另外,要定义和命名数字数据类型,您可以使用类的对象金宝appsimulink.numerictype

创建

You can use either the Model Explorer or MATLAB®commands to create a data type alias.

To use the Model Explorer to create an alias:

  1. On the Model Explorer模型层次结构窗格,选择基本工作区

    您必须在MATLAB工作区或数据字典中创建数据类型别名。如果您尝试在模型工作区中创建别名,则Simulink软件会显示错误。金宝app

  2. From the Model Explorer添加菜单,选择金宝appsimulink.Airstype

    Simulink software creates an instance of a金宝appsimulink.Airstype对象并将其分配给一个命名的变量一个lias在MATLAB工作区中。

  3. 将变量重命名为更合适的名称,例如反映其预期用法的名称。

    To change the name, edit the name displayed in the姓名field on the Model ExplorerContentspane.

  4. On the Model Explorer对话pane, in the基本类型字段,输入此别名代表的数据类型的名称。

    You can specify the name of any existing standard or user-defined data type in this field. Skip this step if the base type isdouble(the default).

生成金宝appsimulink.Airstype对应的对象typedefstatements in your external C code, consider using theSimulink.importExternalCTypes功能。

要以编程方式创建数据类型别名,请使用金宝appsimulink.Airstype下面描述的功能。

Description

例子

aliasObj = Simulink.AliasType返回a金宝appsimulink.Airstype具有默认属性值的对象。

例子

aliasObj = Simulink.AliasType(底型返回a金宝appsimulink.Airstypeobject and initializes the value of the底型property by using底型

特性

expand all

有关属性的信息,请参阅金宝appsimulink.Airstype对象,请参阅金宝appsimulink.Airstype属性对话框

姓名of the base data type that this alias renames, specified as a character vector or string scalar. You can specify the name of a standard data type, such asint8or一半,或自定义数据类型的名称,例如另一个名称金宝appsimulink.Airstype对象或枚举的名称。

要指定定点数据类型,您可以使用调用FIXDTfunction, such as'fixdt(0,16,7)'

您可以在一个例外情况下指定非标准数据类型,例如金宝appsimulink.numerictypeobject, by specifying the data type name. The exception is a金宝appsimulink.numerictype谁的DataTypeModeisFixed-point: unspecified scaling

笔记

Fixed-point: unspecified scaling是一种部分指定的类型,其定义是由使用该块完成的金宝appsimulink.numerictype。Forbidding its use in alias types avoids creating aliases that have different base types depending on where they are used.

对应于基本类型in the property dialog box.

Example:'int8'

Example:'Myotheralias'

数据类型:char|细绳

规范生成或导入类型定义(typedef)in the generated code (Simulink Coder),指定为'汽车',,,,'Exported, 或者“进口”

该表显示了每个选项的效果。

Value 行动
'汽车'(default) If no value is specified forHeaderFile,将类型定义导出到model_types.h,,,,wheremodelis the model name. If you have an Embedded Coder license, and you have specified a data type replacement, then export the type definition tortwtypes.h

如果指定了一个值HeaderFile,从指定的标头文件导入数据类型定义。
“出口” Export the data type definition to a header file, which can be specified in theHeaderFileproperty. If no value is specified forHeaderFile,,,,the header file name defaults totype。htypeis the data type name.
“进口” Import the data type definition from a header file, which can be specified in theHeaderFileproperty. If no value is specified forHeaderFile,,,,the header file name defaults totype。htypeis the data type name.

For more information, seeControl File Placement of Custom Data Types(嵌入式编码器)

对应于Data scopein the property dialog box.

数据类型别名的自定义描述,指定为字符向量。

对应于Descriptionin the property dialog box.

Example:'This type alias corresponds to a floating-point implementation.'

数据类型:char

包含类型定义的标头文件的名称(typedef)在生成的代码中,指定为字符向量。

If this property is specified, the specified name is used during code generation for importing or exporting. If this property is empty, the value defaults totype。hifDataScopeequals“进口”or“出口”,或默认为model_types.hifDataScopeequals'汽车'

默认情况下,生成#包括指令使用预处理器定界符代替<and>。生成the directive#include ,,,,specifyHeaderFile作为''

For more information, seeControl File Placement of Custom Data Types(嵌入式编码器)

对应于Header filein the property dialog box.

Example:'myhdr.h'

Example:'myHdr'

Example:'myHdr.hpp'

数据类型:char

Examples

collapse all

为枚举类型创建一个名称的别名Sldemosign

myenumalias = 金宝appsimulink.Airstype('Enum: SlDemoSign');

To create an alias for a fixed-point data type by using a金宝appsimulink.Airstypeobject, set the底型property of the object by using a call to theFIXDT功能。的价值底型必须指定为字符向量。

例如,此代码为具有单词长度的未签名的定点数据类型创建一个别名16and fraction length7

myFixptAlias = Simulink.AliasType; myFixptAlias.BaseType ='fixdt(0,16,7)';

扩展功能

定点转换
Design and simulate fixed-point systems using Fixed-Point Designer™.

Introduced before R2006a