find
Identify specified objects in hierarchy
Syntax
Description
returns an array of Stateflow® API objects in the hierarchy of objArray
= find(location
,propertyName
,propertyValue
)location
that have a
property called propertyName
with a value of
propertyValue
.
returns the objects that have a property called objArray
= find(location
,"-regexp",propertyName
,propertyValue
)propertyName
with a
value that matches the regular expression specified by propertyValue
.
For more information, see Regular Expressions.
returns the objects in the hierarchy of objArray
= find(location
,"-isa",objectType
)location
that have the type
specified by objectType
.
returns the objects that have a property with the specified name.objArray
= find(location
,"-property",propertyName
)
returns the objects that have an object function with the specified name.objArray
= find(location
,"-method",functionName
)
combines search criteria specified by using the previous syntaxes. Use one of these
logical operations:objArray
= find(location
,___,logicalOp,___)
"-and"
— Results must match both search criteria."-or"
— Results must match at least one of the criteria."-xor"
— Results must match exactly one of the criteria.
When using multiple logical operations, -and
has the
highest precedence, while -or
and -xor
are
right-associative. If no logical operation is specified, -and
is
assumed.
Examples
Input Arguments
Output Arguments
Tips
To limit search results based on the value of a subproperty, call
find
using"-function"
and a function handle. For an example, see Find Objects for Which Signal Logging Is Enabled.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:
Load the library model by calling the function
load_system
(Simulink).Call the function
find_system
(Simulink) with theFollowLinks
argument set toon
:find_system(FollowLinks="on");
View a linked subsystem or block in the main model.
Compile or simulate the model.
Version History
Introduced before R2006a