find

Class: Simulink.data.dictionary.Section
Package: Simulink.data.dictionary

Search in data dictionary section

Syntax

foundEntries = find(sectionObj,PName1,PValue1,...,PNameN,PValueN)
foundEntries = find(sectionObj,PName1,PValue1,...,PNameN,PValueN,options)

Description

foundEntries = find(sectionObj,PName1,PValue1,...,PNameN,PValueN) searches the data dictionary section sectionObj using search criteria PName1,PValue1,...,PNameN,PValueN, and returns an array of matching entries that were found in the target section. This syntax matches the search criteria with the properties of the entries in the target section but not with the properties of their values. See Simulink.data.dictionary.Entry for a list of data dictionary entry properties.

foundEntries = find(sectionObj,PName1,PValue1,...,PNameN,PValueN,options) searches for data dictionary entries using additional search options. For example, you can match the search criteria with the values of the entries in the target section.

Input Arguments

expand all

Data dictionary section to search, 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.

Search criteria, specified as one or more name-value pairs representing names and values of properties of the entries in the target data dictionary section. For a list of the properties of a data dictionary entry, see Simulink.data.dictionary.Entry. If you specify more than one name-value pair, the returned entries meet all of the criteria.

If you include the '-value' option to search in the values of the entries, the search criteria apply to the values of the entries rather than to the entries themselves.

Example: 'LastModifiedBy','jsmith'

Example: 'DataSource','myRefDictionary_ex_API.sldd'

Additional search options, specified as one or more of the following supported option codes.

'-value'This option causes find to search only in the values of the entries in the target data dictionary section. Specify this option before any other search criteria or options arguments.
'-and', '-or', '-xor', '-not' logical operatorsThese options modify or combine multiple search criteria or other option codes.
'-property',propertyNameThis name-value pair causes find to search for entries or values that have the property propertyName regardless of the value of the property. Specify propertyName as a character vector.
'-class',classNameThis name-value pair causes find to search for entries or values that are objects of the class className. Specify className as a character vector.
'-isa',classNameThis name-value pair causes find to search for entries or values that are objects of the class or of any subclass derived from the class className. Specify className as a character vector.
'-regexp'This option allows you to use regular expressions in your search criteria. This option affects only search criteria that follow '-regexp'.

Example: '-value'

Example: '-value','-property','CoderInfo'

Example: '-value','-class','Simulink.Parameter'

Output Arguments

expand all

Data dictionary entries matching the specified search criteria, returned as an array of Simulink.data.dictionary.Entry objects.

Examples

expand all

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');

Return all of the entries stored in the Design Data section of the data dictionary myDictionary_ex_API.sldd.

allEntries = find(dDataSectObj)

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');

Search in the Design Data section of myDictionary_ex_API.sldd for entries whose values are objects of the Simulink.Parameter class.

foundEntries = find(dDataSectObj,'-value','-class','Simulink.Parameter')

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');

Search in the Design Data section of myDictionary_ex_API.sldd for entries that were last modified by the user jsmith.

foundEntries = find(dDataSectObj,'LastModifiedBy','jsmith')

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');

Search in the Design Data section of myDictionary_ex_API.sldd for entries that were last modified by the user jsmith or whose names begin with fuel.

foundEntries = find(dDataSectObj,'LastModifiedBy','jsmith','-or',...
'-regexp','Name','fuel*')

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');

Search in the Design Data section of myDictionary_ex_API.sldd for entries whose names begin with fuel.

foundEntries = find(dDataSectObj,'-regexp','Name','fuel*')

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');

Return all of the entries stored in the Design Data section of the data dictionary myDictionary_ex_API.sldd.

allEntries = find(dDataSectObj);

Find the entries with value 237. If you find more than one entry, store the entries in an array called foundEntries.

foundEntries = [];
for i = 1:length(allEntries)
    if getValue(allEntries(i)) == 237
        foundEntries = [foundEntries allEntries(i)];
    end
end

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');

Search in the Design Data section of myDictionary_ex_API.sldd for entries whose values have a property DataType.

foundEntries = find(dDataSectObj,'-value','-property','DataType')

Alternatives

You can use Model Explorer to search a data dictionary for entries using arbitrary criteria.

Introduced in R2015a