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

    function [bdev,haveCreatedBranch] = makeBdryNode(bdev,level)
%MAKEBDRYNODE make boundary node
% 
% [bdev,haveCreatedBranch] = makeBdryNode(bdev,level)


%  Copyright 2008 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin<2
    level = getstages(level);
end
pr = root(bdev);
% Get the user to choose "response", "local" or global" node
haveCreatedBranch = false;
if pr.getnumstages == 2,
    % When we have two stage data we need to get the user to choose which
    % level they want to build constraints at.
    children = pr.children;
    stages = pr.children( @getstages );
    index = find( cat( 1, stages{:} ) == level );
    if isempty( index ),
        % make branch node if required
        branch = pr.makechildren( false, level );
        if isempty( branch ),
            error(message('mbc:xregbdrydev:InvalidState', level));
        end
        pBranch = address( branch );
        pr.AddChild( pBranch );
        pr.addbest( pBranch );
        haveCreatedBranch = true;
    else
        pBranch = children(index);
    end
else
    pBranch = pr;
end

% make node
bdev = pBranch.makechildren;
pBranch.AddChild( bdev );


bdev = info(bdev);