www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mctree/AddChild.m
function T = AddChild(T, NewChild) %ADDCHILD Add a child to the tree node % % T = ADDCHILD(T,NewChild) adds NewChild as a child of the node T. % NewChild may be a tree object or a pointer to a tree. The static copy of % the tree is returned, but this is not usually needed as the updated tree % is stored dynamically. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. if isa(NewChild, 'xregpointer') NewChild = info(NewChild); end % sets NewChild's parent to be T NewChild.Parent = address(T); % get pointer to NewChild and append to T.Children p = xregpointer(NewChild); T.Children = [T.Children p]; % updates dynamic copy of T xregpointer(T);