MATLAB ヘルプ センター
オブジェクトの子の特定
objArray = getChildren(parent)
objArray = getChildren(parent) は、指定された親をもつオブジェクトの配列を返します。
objArray
parent
例
すべて折りたたむ
この例では次を使用します。
このチャートには、ステート A とデフォルト遷移の 2 つが子として含まれています。ステート A には、ステート A1、ステート A2、および 2 つの遷移の 4 つが子として含まれています。
A
A1
A2
モデルを開き、チャートの Stateflow.Chart オブジェクトにアクセスします。
Stateflow.Chart
open_system("sfHierarchyAPIExample") ch = find(sfroot,"-isa","Stateflow.Chart");
チャートの子を特定します。子のオブジェクト タイプを表示します。
children = getChildren(ch); classes = arrayfun(@class,children,UniformOutput=false)
classes = 2×1 cell {'Stateflow.State' } {'Stateflow.Transition'}
children の 1 つの要素はステートです。ステートの名前を表示します。
children
idx = (classes=="Stateflow.State"); state = children(idx); state.Name
ans = 'A'
ステート A の子を特定します。子のオブジェクト タイプを表示します。
grandchildren = getChildren(state); classes = arrayfun(@class,grandchildren,UniformOutput=false)
classes = 4×1 cell {'Stateflow.State' } {'Stateflow.State' } {'Stateflow.Transition'} {'Stateflow.Transition'}
grandchildren の 2 つの要素はステートです。ステートの名前を表示します。
grandchildren
idx = (classes=="Stateflow.State"); grandchildren(idx).Name
ans = 'A1'
ans = 'A2'
Stateflow.State
Stateflow.Box
Stateflow.Function
親オブジェクト。次のいずれかのタイプの Stateflow® API オブジェクトとして指定します。
Stateflow.EMChart
Stateflow.EMFunction
Stateflow.SimulinkBasedState
Stateflow.SLFunction
Stateflow.StateTransitionTableChart
Stateflow.TruthTable
Stateflow.TruthTableChart
R2006a より前に導入
find
getParent
arrayfun
class
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ