find
Identify specified objects in hierarchy
Syntax
Description
returns an array of objects in the hierarchy of objArray
= find(location
,Name,Value
)location
that match the
criteria specified by one or more Name,Value
pair arguments.
returns objects that do not match the criteria specified by the subsequent
objArray
= find(location
,"-not",Name,Value
)Name,Value
pair argument.
indicates that the subsequent objArray
= find(location
,"-regexp",Name,Value
)Name,Value
pair argument contains a
regular expression. For more information, see Regular Expressions.
combines search criteria by using one of these logical operations:objArray
= find(location
,___,logicalOp,___)
"-and"
— Results must match both search criteria."-or"
— Results must match at least one criterion."-xor"
— Results must match exactly one criterion.
When using various logical operators, -and
has the highest
precedence, while -or
and -xor
are right-associative.
If no logical operator is specified, then -and
is assumed.
Examples
Input Arguments
Output Arguments
Tips
Using the
find
function onSimulink.Root
,Simulink.BlockDiagram
, orStateflow.Machine
objects can return Simulink objects that match the search criteria you specify. For example, this command can return a Simulink subsystem or block namedABC
:find(sfroot,"Name","ABC")
Opening a main model that refers to a linked Stateflow chart does not guarantee that the Stateflow API can find the linked chart. To access the objects in a linked library chart, first load the library model into the Simulink workspace by performing one of these tasks:
Open the library model.
View a linked subsystem or block in the main model.
Compile or simulate the model.
Call the function
find_system
(Simulink) with theFollowLinks
argument set toon
:find_system(FollowLinks="on");
Version History
Introduced before R2006a