Simulink.findVars
Analyze relationship between variables and blocks in models
Syntax
Description
[
finds
and returns variables that are used in the blocks and models specified
by variables
] = Simulink.findVars(context
)context
, including subsystems and referenced
models. The function returns an empty vector if context
does
not use any variables.
[
finds
only the variables or enumerated types that are specified by variables
] = Simulink.findVars(context
,variablefilter
)variablefilter
.
For example, use this syntax to determine where a variable is used
in a model.
[
finds
variables with additional options specified by one or more variables
] = Simulink.findVars(___,Name,Value
)Name,Value
pair
arguments. For example, you can search for unused variables. You can
also search for enumerated data types that are used in context
,
in addition to variables.
Examples
Input Arguments
Limitations
Simulink.findVars
does not work with these
constructs:
MATLAB® code in scripts and initialization and callback functions.
Libraries and blocks in libraries.
Variables in MATLAB Function blocks, except for input arguments. However,
Simulink.findVars
can find enumerated types anywhere they are used in MATLAB Function blocks.Calls directly to MATLAB from a Stateflow® block.
S-functions that use data type variables registered using
ssRegisterDataType
. To make the variables searchable, usessRegisterTypeFromNamedObject
instead.Variables inside a string.
Fields in a
struct
.Top models configured for parallel model reference builds. In this case,
Simulink.findVars
does not work when called with either of these name-value arguments:'SearchMethod'
specified as'cached'
'SearchReferencedModels'
specified as'on'
Simulink.findVars
discovers variable usage in inactive subsystem variants
only if you set the Variant activation time parameter to
code compile
in the Variant Subsystem
block dialog box. If you do not select this check box, the function does not discover
variable usage in inactive variants.
Version History
Introduced in R2010a