MATLAB 帮助中心
标识对象的父级
parent = getParent(object)
parent = getParent(object) 返回 Stateflow® 图、State Transition Table、Truth Table 或 MATLAB® Function 模块中一个对象的父级。
parent
object
示例
全部折叠
此示例使用:
在此图中,状态 A1 的父级是状态 A。状态 A 的父级是图。
A1
A
打开模型并访问图的 Stateflow.Chart 对象。
Stateflow.Chart
open_system("sfHierarchyAPIExample") ch = find(sfroot,"-isa","Stateflow.Chart");
找到名为 A1 的 Stateflow.State 对象。
Stateflow.State
sA1 = find(sfroot,"-isa","Stateflow.State",Name="A1");
标识状态 A1 的父级。显示父级的名称。
parent = getParent(sA1); parent.Name
ans = 'A'
标识状态 A 的父级。显示父级的名称。
grandparent = getParent(parent); grandparent.Name
ans = 'Chart'
Stateflow.Box
Stateflow.Function
Stateflow 图、State Transition Table、Truth Table 或 MATLAB Function 模块中的对象,指定为以下类型之一的 Stateflow API 对象:
Stateflow.Annotation
Stateflow.AtomicBox
Stateflow.AtomicSubchart
Stateflow.Data
Stateflow.EMFunction
Stateflow.Event
Stateflow.Junction
Stateflow.Message
Stateflow.Port
Stateflow.SimulinkBasedState
Stateflow.SLFunction
Stateflow.Transition
Stateflow.TruthTable
在 R2006a 之前推出
find
getChildren
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处