Main Content

このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。

getChildren

オブジェクトの子の特定

説明

objArray = getChildren(parent) は、指定された親をもつオブジェクトの配列を返します。

すべて折りたたむ

このチャートに対応する Stateflow.Chart オブジェクトが ch であるとします。このチャートには、ステート A とデフォルト遷移の 2 つが子として含まれています。ステート A には、ステート A1、ステート A2、および 2 つの遷移の 4 つが子として含まれています。

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

チャート ch の子を特定します。子のオブジェクト タイプを表示します。

children = getChildren(ch);
arrayfun(@class,children,UniformOutput=false)
ans =

  2×1 cell array

    {'Stateflow.State'     }
    {'Stateflow.Transition'}

children の最初の要素はステートです。ステートの名前を表示します。

state = children(1);
state.Name
ans =

    'A'

ステート A の子を特定します。子のオブジェクト タイプを表示します。

grandchildren = getChildren(state);
arrayfun(@class,grandchildren,UniformOutput=false)
ans =

  4×1 cell array

    {'Stateflow.State'     }
    {'Stateflow.State'     }
    {'Stateflow.Transition'}
    {'Stateflow.Transition'}

grandchildren の最初の 2 つの要素はステートです。ステートの名前を表示します。

grandchildren(1).Name
ans =

    'A1'
grandchildren(2).Name
ans =

    'A2'

入力引数

すべて折りたたむ

バージョン履歴

R2006a より前に導入