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

    function [mdev,OK] = CopyOutliers(mdev)
%COPYOUTLIERS Show the Copy Outliers dialog
%
%  MDEV = COPYOUTLIERS( MDEV );
%

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

OK = false;
if address(mdev)==0
    mbh= MBrowser;
    p = get(mbh,'CurrentNode');
    mdev= info(p);
end

dlg = mbcgui.container.Dialog('Name','Copy Outliers',...
    'Size',[240 340],...
    'Buttons','OK_CANCEL',...
    'Resize', 'off');
fh = dlg.Figure;
xregcenterfigure(fh);
T= mdevtestplan(mdev);

h= treeview(T,'create',[20 20 200 400],fh,cell(0,2));

helpStr = 'Select the model whose outliers you want to copy.';
txt = uicontrol('Parent', fh,...
    'Style', 'text',...
    'HorizontalAlignment', 'left',...
    'String', helpStr);

lyt=xreggridbaglayout(fh,...
    'dimension',[2,1],...
    'correctalg','on',...
    'rowsizes', [32, -1],...
    'border', [5, 5, 5,5],...
    'gapx',7,...
    'gapy', 7,...
    'elements',{txt,h});

dlg.Content = lyt;

% Select this mdev
treeview(mdev,'select',h);

closeMode = dlg.showDialog();

if strcmp(closeMode,'OK')

    p= treeview(T,'current',h);
    Xc= getdata(mdev,'X');
    Xn= p.getdata('X');

    if size(Xn,1)==size(Xc,1) && p~=address(mdev) && ~p.isa('mdevtestplan')

        drawnow update
        mdNew= p.info;
        mdev.Outliers=  mdNew.Outliers;
        % refit model
        refit(mdev);
        mdev= info(mdev);
        if isa(mdev,'mdev_local')
            % refit all response features
            mdev = UpdateLinks(mdev,2,MBrowser);
        end
        OK = true;
        
    else
        h = warndlg('Incorrect node selected.','Copy Outliers','modal');
        waitfor(h);
    end

end
delete(dlg);

mdev= info(mdev);