Identify matching entry or exit port
Stateflow.findMatchingPort returns a single
Stateflow.Port object. However, when an entry or exit junction is
located in the top level of a linked atomic subchart,
Stateflow.findMatchingPort returns an array that contains a
Stateflow.Port object for each instance of the atomic subchart
that is open.
Add Exit Port and Junction to Atomic Subchart
Stateflow.AtomicSubchart object that corresponds to the
A in the chart
atomicSubchart = find(ch,"-isa","Stateflow.AtomicSubchart",Name="A");
Add an exit junction to the atomic subchart. Use the
property of the atomic subchart as the parent of the exit junction. Display the
value of the
PortType property of the exit junction.
exitJunction = Stateflow.Port(atomicSubchart.Subchart,"ExitJunction"); exitJunction.PortType
ans = 'ExitJunction'
Set the label of the exit junction to
exitJunction.labelString = "exit";
Stateflow.Port object for the matching exit port.
Display the value of the
PortType property of the exit
exitPort = Stateflow.findMatchingPort(exitJunction); exitPort.PortType
ans = 'ExitPort'
Display the label of the exit port.
ans = 'exit'
If you move an entry or exit junction to a different parent, Stateflow® deletes the
Stateflow.Portobject for the matching port and creates a
Stateflow.Portobject on the new parent. To identify the new matching port, use the
Introduced in R2021b