Main Content


Identify parent of object



parent = getParent(object) returns the parent of an object in a Stateflow® chart, State Transition Table, Truth Table, or MATLAB® Function block.


collapse all

Suppose that ch is the Stateflow.Chart object that corresponds to this chart. In this chart, the parent of state A1 is state A. The parent of state A is the chart.

Stateflow chart with a hierarchy of states. The outer state is called A. It contains two inner states called A1 and A2.

Find the Stateflow.State object named A1.

sA1 = find(ch,"-isa","Stateflow.State",Name="A1");

Identify the parent of state A1. Display the name of the parent.

parent = getParent(sA1);
ans =


Identify the parent of state A. Display the name of the parent.

grandparent = getParent(parent);
ans =


Input Arguments

collapse all

Version History

Introduced before R2006a