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
vars
= Simulink.findVars(ctxt
)context
, including subsystems and referenced models. The
function returns an empty vector if context
does not use any
variables.
finds variables with additional options specified by one or more
vars
= 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 by using
ssRegisterDataType
. To make the variables searchable, usessRegisterTypeFromNamedObject
instead.Variables inside a string.
Fields in a structure.
When
'SourceType'
is specified as'external source'
,Simulink.findVars
does not identify unused variables.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'
Note
Simulink.findVars
does not discover variable usage in
inactive Variant Subsystem blocks or inactive paths of Variant
Source or Variant Sink blocks if the Variant
activation time parameter is set to update
diagram
.
Version History
Introduced in R2010a