This example shows how to use linked atomic subcharts to break a Stateflow® chart into subcomponents so that multiple people can work on different parts of the chart. Atomic subcharts are not supported in standalone Stateflow charts in MATLAB®. For more information, see Create Reusable Subcomponents by Using Atomic Subcharts.
This model contains two Sine Wave (Simulink) blocks: one with a frequency of 1 radian per second, and the other with a frequency of 2 radians per second.
In the chart, each state uses saturator logic to convert the input sine wave to an output square wave of the same frequency.
Because this example does not use atomic subcharts, only one person at a time can edit the model. If you edit state
A while someone else edits state
B, you must merge those changes at submission time.
In contrast, you can store different parts of this example as linked atomic subcharts. Because atomic subcharts behave as independent objects, different people can work on different parts of a chart without affecting the other parts of the chart. At submission time, no merge is necessary because the changes exist in separate models.
Step 1: Convert a State to an Atomic Subchart
A and select Group & Subchart > Atomic Subchart. State
A changes to an atomic subchart and displays the label Atomic in the upper-left corner.
Step 2: Create a Library for the Atomic Subchart
Create a new library model.
Copy the atomic subchart and paste it in your library model.
Save your library model.
In the library model, the atomic subchart appears as an independent chart with an input port and an output port.
Step 3: Replace State with Linked Atomic Subchart
A in the chart.
Copy the atomic subchart in your library and paste it in your chart.
The linked atomic subchart appears opaque and contains the label Link in the upper-left corner.
Suppose that, in the library chart, you edit the transition from
This change propagates to the linked atomic subchart in the main chart. If someone else edits the main chart, the changes are merged automatically.
Sine Wave (Simulink)