Guidelines for Using the Operating Point of a Chart
An operating point is a snapshot of the state of a Simulink® model at a specific time during simulation. For a Stateflow® chart, an operating point includes:
Activity of chart states
Values of chart local data
Values of chart output data
Values of persistent data in MATLAB® functions and Truth Table blocks
For more information, see Using Operating Points in Stateflow.
Limitations on Values You Can Modify
An operating point does not include information about these elements:
Persistent data in custom C code
Persistent data in external MATLAB code
Therefore, you cannot modify the values of those elements.
Rules for Modifying Data Values
These rules apply when you modify data values:
You cannot change the data type or size. Scalar data must remain scalar. Vector and matrix data must keep the same dimensions. The only exception to this rule is Stateflow data of
mltype (see ml Data Type for details).
For enumerated data types, you can choose only enumerated values from the type definition. For other data types, new values must fall within the range that you specify in the Minimum and Maximum parameters.
Use one-based indexing to define rows and columns of a matrix.
Suppose that you want to change the value of an element in a 21-by-12 matrix. To modify the element in the first row and second column, type:
c.state_name.data_name.Value(1,2) = newValue;
Rules for Modifying State Activity
These rules apply when you use the
setActive method on an exclusive
(OR) leaf state:
State-parented local data does not reinitialize.
The newly active state does not execute any entry actions. Similarly, the previously active state does not execute any exit actions.
If you want these state actions to occur, you must execute them separately. For example, if your state actions assign values to data, you must assign the values explicitly.
setActivemethod tries to maintain state consistency by:
Updating state activity for parent, grandparent, and sibling states
Resetting temporal counters for newly active states
Updating values of state output data (read-only)
Enabling or disabling function-call subsystems and Simulink functions that bind to states
highlightActiveStatesmethod also executes when these conditions are true:
The model is open.
The chart is visible.
highlightActiveStatesmethod has executed at least once, but not the
Restriction on Continuous-Time Charts
After you load an operating point for a continuous-time chart, you can restart simulation from a nonzero time. However, you cannot modify the state activity or any data values, because the operating point for a continuous-time chart is read-only. For more information, see Continuous-Time Modeling in Stateflow.
Restriction on Charts That Use Edge Detection
Stateflow charts that use edge detection operators do not support operating points. For more information, see Detect Changes in Data and Expression Values.
No Partial Loading of an Operating Point
When you load an operating point, the complete operating point is available as a variable in the MATLAB base workspace. You cannot perform partial loading of an operating point for a subset of chart objects.
Restriction on Copying Operating Point Values
clone method to copy an entire operating point to a new
variable (see Methods for Interacting with the Operating Point of a Chart). You cannot copy a subset
of operating point values, because the
clone method works only at the
Suppose that you obtain a handle to the operating point of your chart using these commands:
blockpath = 'model/chart'; c = xFinal.get(modelOperatingPoint, blockpath);
Assignment statements such as
stateCopy = c.state,
= c.data, and
operatingPointCopy = c do not work. These
assignments create copies of object handles, not operating point values.