MATLAB: Can I create a straight-line default transition using the Stateflow API

apidefaultlinestateflowstraighttransition

I would like to create a straight-line default transition using the Stateflow API, but even when I define it as a smart transition, the transition is always curved .

Best Answer

The ability to draw a straight-line default transition using the external Stateflow API is not available in Stateflow.
To work around this issue, you can use the internal Stateflow API. Be aware, however, that using the internal Stateflow API is not supported, and the syntax can change in a future release of Stateflow.
Here is an example of how you can create a vertical straight-line default transition to a junction in Stateflow:
sfnew
rt = sfroot;
m = rt.find('-isa','Stateflow.Machine');
chart = m.findDeep('Chart');
junct = Stateflow.Junction(chart);
junct.Position.Center = [100 100];
dt = Stateflow.Transition(chart);
dt.Destination = junct;
dt.DrawStyle = 'SMART';
dt.SourceEndPoint = [100 100 - (junct.Position.Radius + 30)];
dt.DestinationOClock = 0;
sf('set',dt.id,'transition.src.intersection.direction',[0 0])