www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregMdlGui/@boxcox/doButtonCallback.m

    function doButtonCallback(obj,arg)
%DOBUTTONCALLBACK Execute callback in boxcox gui
%
%  DOBUTTONCALLBACK(ACTION) executes the specified callback action from the
%  boxcox gui.

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


switch arg
    case 'btclear'
        % Clear transformation button clicked. Set lambda to 1
        obj.Lambda = 1;

    case 'btminimise'
        % minimised press
        % Minimise button clicked. Find the smallest sse value in the clickable
        % points list ...
        [~,index]=min(obj.possValues);
        % and set that as the current ncenters
        obj.Lambda = obj.possLambda(index);

    case 'edlambda'

        % set lambda to be the value in the edit box
        obj.Lambda = obj.editH.Value;

    case 'ok'
        set(obj.figure, 'Visible', 'off');

        % Get the current value of lambda and a pointer to the model
        % from the layout object
        ChosenLambda = obj.Lambda;
        p = obj.ptrMdev;

        % Extract the model and Y matrices from the pointer
        m = p.model;
        Y = p.getdata('Y');

        if ChosenLambda == 1
            % if lambda is 1 then no transformation is necessary
            set(m,'ytrans','');
        else
            % otherwise set the transformation
            set(m,'boxcox',{ChosenLambda,double(Y)});
        end

        % Update the model
        p.model(m);
        % Fit the model
        p.fitmodel;
        
        if ~isempty(obj.UpdateFcn)
            obj.UpdateFcn();
        end

        delete(obj);

    case 'cancel'
        set(obj.figure, 'Visible', 'off');
        doButtonCallback(obj,'clear');
        delete(obj);
end