www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mctree/mctree.m

    function T = mctree(NewName)
%MCTREE Tree constructor
%
%  OBJ = MCTREE(NAME) constructs a new tree object with the given name.

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


if nargin && isstruct(NewName)
    T = NewName;
    R = T.mbcreference;
    T = rmfield(T, 'mbcreference');
    
elseif nargin && isa(NewName,'mctree')
    T = NewName;
    return

else
    if nargin==0
        NewName = 'Node';
    end
    T = struct('Name', NewName,...
        'Parent', mbcpointer(1),...      % pointer to parent
        'Children', mbcpointer(0),... % array of pointers to children
        'TreeIndex', 0,...
        'Version', 2);
    R = mbcreference;
end
T = class(T, 'mctree', R);