Main Content

exist

Check existence of data dictionary entry

Description

doesExist = exist(sectionObj,entryName) determines if the data dictionary section sectionObj contains an entry by the name of entryName and returns an indication.

example

Examples

collapse all

Determine if an entry exists in a data dictionary by searching for the name of the entry

Represent the Design Data section of the data dictionary myDictionary_ex_API.sldd with a Simulink.data.dictionary.Section object named dDataSectObj.

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

Determine if an entry fuelFlow exists in the Design Data section of myDictionary_ex_API.sldd.

exist(dDataSectObj,'fuelFlow')
ans =

     1

Determine if an entry myEntry exists in the Design Data section of myDictionary_ex_API.sldd.

exist(dDataSectObj,'myEntry')
ans =

     0

Input Arguments

collapse all

Target data dictionary section, specified as a Simulink.data.dictionary.Section object. Before you use this function, represent the target section with a Simulink.data.dictionary.Section object by using, for example, the getSection function.

Name of target entry, specified as a character vector.

Example: 'myEntry'

Data Types: char

Output Arguments

collapse all

Indication of entry existence, returned as 0 if false and 1 if true.

Tips

  • exist also determines if a matching entry exists in the same section of any referenced data dictionaries. For example, if sectionObj represents the Design Data section of a data dictionary myDictionary_ex_API.sldd, exist searches the Design Data section of myDictionary_ex_API.sldd and the Design Data sections of any dictionaries referenced by myDictionary_ex_API.sldd.

Alternatives

You can use Model Explorer to search a data dictionary for an entry.

Version History

Introduced in R2015a