www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgnode/project.m

    function nd=project(obj)
%CGPROJECT  Return nearest cgproject up the tree
%
% ND=CGPROJECT(STARTNODE)  traverses up the tree searching for
% the nearest cgproject in the ancestry.
%

%  Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.



p=Parent(obj);
while isvalid(p) && ~isa(obj,'cgproject')
   obj=info(p);
   p=Parent(obj);
end

if isa(obj,'cgproject')
	nd=obj;
else
	error(message('mbc:cgnode:InvalidArgument'));
end