get_root_system.m

来自「一个matlab的将军模型」· M 代码 · 共 18 行

M
18
字号
function sys = get_root_system(sys)

% Get the root level system for a given subsystem
%
% Syntax:
%   "root = get_root_system(sys)"
%
% Description:
%   "get_root_system(sys)" returns the root level system (system with no
%   parents in the hierarchy) containing the subsystem "sys".

parent = get_param(sys,'Parent');
while ~isempty(parent)
  sys = parent;
  parent = get_param(sys,'Parent');
end
return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?