A parameter is a constant data object that you can:
Define in the MATLAB® base workspace.
Derive from a Simulink® block parameter that you define and initialize in a mask.
Use parameters to avoid hard-coding data values and properties. Share Simulink parameters with charts to maintain consistency with your Simulink model.
You can access parameter values in multiple Stateflow® objects in a chart such as states, MATLAB functions, and truth tables. You can include parameters in expressions defining data properties such as:
Size
Type
Initial Value
Minimum and Maximum
Fixed-Point Data Properties
For more information, see Specify Data Properties by Using MATLAB Expressions
You can initialize a parameter by defining it in the MATLAB base workspace and in the Stateflow hierarchy.
Define and initialize a variable in the MATLAB base workspace.
In the Stateflow hierarchy, define a data object with the same name as the MATLAB variable.
Set the scope of the Stateflow data object to Parameter.
When the simulation starts, data resolution occurs. During this process, the Stateflow parameter gets its value from the associated MATLAB variable.
You can share a parameter from a Simulink subsystem containing a Stateflow chart by creating a mask for the subsystem.
In the Simulink mask editor for the parent subsystem, define and initialize a Simulink parameter.
In the Stateflow hierarchy, define a data object with the same name as the Simulink parameter.
Set the scope of the Stateflow data object to Parameter.
When the simulation starts, Simulink tries to resolve the Stateflow data object to a parameter at the lowest-level masked subsystem. If unsuccessful, Simulink moves up the model hierarchy to resolve the data object to a parameter at higher-level masked subsystems.