Main Content

sfroot

Root of Stateflow hierarchy

Description

example

root = sfroot returns the Simulink.Root object at the top level of the Stateflow® hierarchy of objects. Use the Root object to access all other API objects in your charts. For more information, see Access Objects in Your Stateflow Chart.

Examples

collapse all

Open a Simulink® model called myModel. Suppose that the model contains a Stateflow chart with a state named A.

open_system('myModel')

Access the Simulink.Root object at the top level of the Stateflow hierarchy.

rt = sfroot;

Find the state named A.

st = find(rt,'-isa','Stateflow.State','Name','A');

Zoom in on the state in the Stateflow Editor.

fitToView(st);
Introduced before R2006a