主要内容

up

(不推荐)标识对象的父级

不推荐使用 up。请改用 getParent

说明

parent = up(object) 返回 Stateflow® 图、State Transition TableTruth Table 或 MATLAB® Function 模块中一个对象的父级。

示例

示例

全部折叠

假设 ch 是对应于此图的 Stateflow.Chart 对象。在此图中,状态 A1 的父级是状态 A。状态 A 的父级是图。

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

找到名为 A1Stateflow.State 对象。

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

标识状态 A1 的父级。显示父级的名称。

parent = up(sA1);
parent.Name
ans =

    'A'

标识状态 A 的父级。显示父级的名称。

grandparent = up(parent);
grandparent.Name
ans =

    'Chart'

输入参数

全部折叠

版本历史记录

在 R2006a 之前推出