| Stateflow | ![]() |
Copying by Grouping (Recommended)
Copying a grouped state in Stateflow copies not only the state but all of its contents. By grouping a state before you copy it, you can copy it and all of its contained objects at all levels of containment with the Stateflow API. This is the simplest way of copying objects and should be used whenever possible.
You use the boolean IsGrouped property for a state to group that state. If you set the IsGrouped property for a state to a value of true (=1), it is grouped. If you set IsGrouped to a value of false (=0), the state is not grouped.
The following example procedure copies state A to the chart X through grouping. In this example, assume that you already have a handle to state A and chart X through the MATLAB variables sA and chX, respectively.
IsGrouped property for that state to true (=1).
IsGrouped property value.
| copy Method Limitations | Copying Objects Individually | ![]() |