www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregbdryroot/makechildren.m

    function newchild = makechildren(root, OpenDialog, newStage)
%MAKECHILDREN A short description of the function
%
%  C = MAKECHILDREN(ROOT) is a boundary node object that can be attached to
%  the boundary root node R as a child of R.
%
%  C = MAKECHILDREN(ROOT, [], NEWSTAGE)
%     makechildren( root )
%         If NumStages == 2, then this method compares the type of model
%         in the new child versus the types in the existing children. If
%         that type already exists, then the new child is not added. To add
%         a particular stage use the 3 argument form. NEWSTAGE should be 0
%         (response), 1 (local) or 2 (global). If a child node with the
%         given stage already exists, then no new node will be made and
%         C=[] will be returned. (cf modeldev/makechildren)  
%      
%  See also XREGBDRYDEV, MODELDEV/MAKECHILDREN

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

% Check inputs
if nargin < 2 || isempty( OpenDialog ),
    OpenDialog = 0;
end

switch root.NumStages,
    case 1,
        newchild = xregbdrydev( uniquename( root, 'Boundary' ) );
        
    case 2,
        childstages = children( root, 'getstages' );
        childstages = [ childstages{:} ];
        if nargin < 3,
            newStage = [0, 1, 2];
        end
        newstages = setdiff( newStage, childstages );
        if isempty( newstages ),
            newchild = [];
        else
            switch newstages(1),
                case 0,
                    name = 'Response';
                case 1,
                    name = 'Local';
                case 2,
                    name = 'Global';
            end
            newchild = xregbdrybranch( name, 'Stages', newstages(1) );
        end
end