Simulink.VariableUsage
Store information about the relationship between variables and blocks in models
Description
ASimulink.VariableUsage
object describes where a variable is used in models.
Use this information to:
Prepare to permanently store the variables in files and workspaces. For more information about storing variables for a model, seeDetermine Where to Store Variables and Objects for Simulink Models.
Reduce the number of variables that you need to store by eliminating unused variables.
Prepare to partition variables and establish variable ownership when you work in a team.
To analyze variable usage in models, useSimulink.VariableUsage
objects together with theSimulink.findVars
function. The function returns and acceptsSimulink.VariableUsage
objects as arguments. For more information, seeSimulink.findVars
.
ASimulink.VariableUsage
object can also describe the usage of an enumerated data type.
只有一个Simulink.VariableUsage
constructor or theSimulink.findVars
function can set property values in aSimulink.VariableUsage
object. The properties are otherwise read only.
Creation
TheSimulink.findVars
function returnsSimulink.VariableUsage
objects.
To create variable usage objects for use as a filter when usingSimulink.findVars
, use theSimulink.VariableUsage
function described below.
Syntax
variableUsageObj = Simulink.VariableUsage(varNames,sourceName)
Description
variableUsageObj = Simulink.VariableUsage(
creates an array ofvarNames
,sourceName
)Simulink.VariableUsage
objects to describe the variablesvarNames
. The constructor sets theName
property of each object to one of the variable names specified byvarNames
, and sets theSource
property of all the objects to the source specified bysourceName
. You can specifyvarNames
with variables that are not used in any loaded models.