主要内容

getEntry

创建 Simulink.data.dictionary.Entry 对象来表示数据字典条目

说明

entryObj = getEntry(sectionObj,entryName) 返回一个 Simulink.data.dictionary.Entry 对象数组,这些对象表示在数据字典分区 sectionObj(一个 Simulinkdata.dictionary.Section 对象)中找到的数据字典条目 entryName。如果多个条目具有在数据字典的引用层次结构中指定的名称,则 getEntry 返回多个对象。

示例

entryObj = getEntry(sectionObj,entryName,'DataSource',dictionaryName) 返回一个对象,该对象表示在数据字典 dictionaryName 中定义的一个数据字典条目。使用此语法可唯一标识在引用数据字典的层次结构中一个多次定义的条目。

示例

示例

全部折叠

使用名为 dDataSectObjSimulink.data.dictionary.Section 对象表示数据字典 myDictionary_ex_API.sldd 的“设计数据”分区。

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

使用名为 fuelFlowObjSimulink.data.dictionary.Entry 对象表示数据字典条目 fuelFlowfuelFlow 在数据字典 myDictionary_ex_API.sldd 中定义。

fuelFlowObj = getEntry(dDataSectObj,'fuelFlow');

将条目 fuelFlow 的值设置为 493

setValue(fuelFlowObj,493)

使用名为 dDataSectObjSimulink.data.dictionary.Section 对象表示数据字典 myDictionary_ex_API.sldd 的“设计数据”分区。

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

用名为 refEntryObjSimulink.data.dictionary.Entry 对象表示数据字典条目 myRefEntrymyDictionary_ex_API.sldd 引用 myRefDictionary_ex_API.sldd,并且 myRefDictionary_ex_API.sldd 定义条目 myRefEntry

refEntryObj = getEntry(dDataSectObj,'myRefEntry','DataSource',...
'myRefDictionary_ex_API.sldd');

将条目 myRefEntry 的值设置为 493

setValue(refEntryObj,493)

输入参数

全部折叠

目标数据字典分区,指定为 Simulink.data.dictionary.Section 对象。在使用此函数之前,请使用 getSection 等函数通过 Simulink.data.dictionary.Section 对象来表示目标分区。

目标数据字典条目的名称,指定为字符向量。

示例: 'myEntry'

数据类型: char

包含目标条目的数据字典的文件名,指定为包含 .sldd 扩展名的字符向量。

示例: 'mySubDictionary_ex_API.sldd'

数据类型: char

输出参量

全部折叠

目标数据字典条目,以一个或多个 Simulink.data.dictionary.Entry 对象形式返回。

版本历史记录

在 R2015a 中推出