Stateflow states ordering in Data Inspector

2 views (last 30 days)
When you use a Stateflow chart within Simulink framework, there is the possibility to log the active state. Then, once the simulation has been completed, you can see the results using the Data Inspector. The logged states are plotted along the y-axis, versus time on the x-axis.
I am wondering if there is the possibility to re-order the state labels along the y axis, i. e. to specify which ones are showed on the top and which ones on the bottom. I found out that the default ordering is not always the most useful

Accepted Answer

Atharva
Atharva on 21 Jun 2023
Hey Federico,
In Simulink, the Stateflow chart provides a way to log the active states during simulation and view the results using the Data Inspector. By default, the logged states are plotted along the y-axis in the order of their appearance in the Stateflow chart. However, it is not possible to directly reorder the state labels along the y-axis in the Data Inspector.
To change the ordering of state labels in the Data Inspector, you would need to modify the Stateflow chart itself. The order of appearance of states in the chart determines the order in which they are displayed in the Data Inspector. Therefore, you can rearrange the states in the chart to achieve the desired order in the Data Inspector.
Here are the steps to rearrange the state labels:
  1. Open the Stateflow chart in Simulink.
  2. Double-click on the Stateflow block to enter the Stateflow Editor.
  3. In the Stateflow Editor, you can click and drag the states to change their positions in the chart. Dragging a state up or down will change its order in the Data Inspector.
  4. Rearrange the states according to your preferred order.
  5. Save the Stateflow chart and run the simulation again.
  6. Once the simulation is complete, open the Data Inspector to view the reordered state labels.
By rearranging the states in the Stateflow chart, you can control the order in which they appear along the y-axis in the Data Inspector and achieve a more useful arrangement for your specific needs.

More Answers (0)

Categories

Find more on Complex Logic in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!