主要内容

getDataType

获取 Simulink 接口字典中的数据类型

自 R2022b 起

在 R2023b 中,引入了数据字典的“架构数据”部分。当管理接口、数据类型、常量和软件寻址方法时,请考虑改用 Simulink.dictionary.ArchitecturalData 编程接口。有关详细信息,请参阅Programmatically Manage AUTOSAR Architectural Data

说明

dataTypeObj = getDataType(dictObj,dtName) 返回表示由 dtName 指定的数据类型的数据类型对象。

示例

示例

全部折叠

要获取表示指定数据类型名称的数据类型对象,请使用 getDataType 函数。有关显示相关函数工作流的更多信息的示例,请参阅创建和配置接口字典

dictAPI 字典对象中获取 myColor 数据类型名称的 EnumType 对象。

myColorObj = getDataType(dictAPI,'myColor')
myColorObj = 

  EnumType with properties:

            Name: 'myColor'
     Description: 'I am a Simulink Enumeration'
    DefaultValue: 'BLUE'
     StorageType: 'int16'
       Enumerals: [1×3 Simulink.interface.dictionary.Enumeral]
           Owner: [1×1 Simulink.interface.Dictionary]

dictAPI 字典对象中获取 myAliasType1 数据类型名称的 AliasType 对象。

myAliasType1Obj = getDataType(dictAPI,'myAliasType1')
myAliasType1Obj = 

  AliasType with properties:

           Name: 'myAliasType1'
       BaseType: 'fixdt(1,32,16)'
    Description: ''
          Owner: [1×1 Simulink.interface.Dictionary]

输入参数

全部折叠

接口字典,指定为 Simulink.interface.Dictionary 对象。在使用此函数之前,请使用 Simulink.interface.dictionary.createSimulink.interface.dictionary.open 创建或打开 dictObj

dictObjDataTypes 属性数组中的 DataType 定义名称,指定为字符向量或字符串标量。

示例: "airSpeed"

输出参量

全部折叠

dictObj 字典对象中的 DataType 元素创建的 DataType 对象。

版本历史记录

在 R2022b 中推出

全部折叠