Why is the port order on my Stateflow chart different than what appears in the Model Explorer?

3 views (last 30 days)
I have a Stateflow chart with two input ports, "Port_A" and "Port_B". In the Model Explorer, "Port_A" is assigned to input port 1, and "Port_B" is assigned to input port 2. However when looking at the overview of the chart, "Port_B" is above "Port_A". Why is this happening?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Oct 2022
Input and output ports can be rearranged by dragging and dropping the port arrows on the top model view of the chart. When this happens, the original port numbers are maintained, even if the order that they appear on the chart is different.
If the order that the ports appear on the chart is different than in the Model Explorer, then the ports may have been rearranged inadvertently. If this is the case, you should be able to drag and drop the ports to put them back in the correct order. Regardless of the order that the ports appear, the correct values should be assigned to the ports with the corresponding names.
  1 Comment
Tomasz Larkowski
Tomasz Larkowski on 9 Aug 2022
Edited: Tomasz Larkowski on 9 Aug 2022
Changing manually, say, 50 ports by draging them and dropping to reflect the intended order doesn't exactly sound like the best solution, and more like a workaround. Is there another way of achieving this, perhaps by modifying certain property of one of internal parameters of the stateflow model to unfreeze fixing/mainaining of old port numbers?

Sign in to comment.

More Answers (0)


Find more on Complex Logic in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!