Main Content

find

Search in array of data dictionary entries

Description

example

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

example

foundEntries = find(targetEntries,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 target entries.

Examples

collapse all

Search in an array of data dictionary entries myEntryObjs for entries whose values are objects of the class Simulink.Parameter.

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

Search in an array of data dictionary entries myEntryObjs for entries that were last modified by the user jsmith.

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

Search in an array of data dictionary entries myEntryObjs for entries that were last modified by the user jsmith or whose names begin with fuel.

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

Search in an array of data dictionary entries myEntryObjs for entries whose names begin with Press.

foundEntries = find(myEntryObjs,'-regexp','Name','Press*')

Search in an array of data dictionary entries myEntryObjs for entries whose values are 273. If you find more than one entry, store the entries in an array called foundEntries.

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

Search in an array of data dictionary entries myEntryObjs for entries whose values have a property DataType.

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

Input Arguments

collapse all

Data dictionary entries to search, specified as an array Simulink.data.dictionary.Entry objects. Before you use this function, represent the target entries with Simulink.data.dictionary.Entry objects by using, for example, the getEntry function.

Example: [myEntryObj1,myEntryObj2,myEntryObj3]

Search criteria, specified as one or more name-value pairs representing names and values of properties of the target data dictionary entries. 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 target 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 target data dictionary entries. Specify this option before any other search criteria or options arguments.
'-and', '-or', '-xor', or '-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

collapse all

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

Version History

Introduced in R2015a