www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregMdlGui/@rbfprune/doButtonCallback.m
function doButtonCallback(obj,arg) %DOBUTTONCALLBACK % Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. switch arg case 'btclear' % Clear transformation button clicked. Set ncenters to original % get the model m = obj.ptrMdev.model; centers = get(m,'centers'); ncenters = size(centers(Terms(m),:),1); % and reset the popup set(obj.popH,'Value',2); % get new current line obj.CurrentLineIndex = 2; % this will call doLineIndexUpdate obj.NCenters = ncenters; % this will call doNCenterUpdate case 'chooser' % popup changed % The stat that we choose on has been changed. % need to move the red circle and activate the clickable on this line % get new curRent line obj.CurrentLineIndex = get(obj.popH,'Value'); case 'btminimise' % minimised press % Minimise button clicked. Find the smallest sse value in the clickable % points list ... [ms,index]=min(obj.possValues(obj.CurrentLineIndex,:)); % and set that as the current ncenters obj.NCenters = index; case 'edncenters' % set lambda to be the value in the edit box ncenters = round(str2num(get(obj.editH,'String'))); if ~isempty(ncenters) % compute the sse value at lambda m = obj.ptrMdev.model; allcenters = get(m,'centers'); incenters = allcenters(Terms(m),:); maxncenters = size(incenters,1); ncenters = max(1,min(maxncenters, ncenters)); TermsIn = Terms(m); indices = fliplr(find(TermsIn)');%terms in the model, listed in increasing order of importance [m,OK] = stepwise(m,indices(1:maxncenters-ncenters));% take out the unneeded terms % store cost cost = log10GCV(m); setFitOpt(m,'cost',cost); obj.NCenters = ncenters; end % reset edit box set(obj.editH,'String', num2str(obj.NCenters)); case 'ok' set(obj.figure, 'Visible', 'off'); % Get the current value of lambda and a pointer to the model % from the layout object ChosenNcenters = obj.NCenters; p = obj.ptrMdev; m = p.model; X = p.getdata('X'); Y = p.getdata('Y'); [x,y] = checkdata(m,X,Y); allcenters = get(m,'centers'); incenters = allcenters(Terms(m),:); maxncenters = size(incenters,1); TermsIn = Terms(m); indices = fliplr(find(TermsIn)');%terms in the model, listed in increasing order of importance [m,OK] = stepwise(m,indices(1:maxncenters-ChosenNcenters));% take out the unneeded terms if(get(obj.refitH,'Value')==1) [m, cost ,OK] = cheapwidthopt(m,x,y); else cost = log10GCV(m); end setFitOpt(m,'cost',cost); p.model(m);% update model if OK S = FitSummary(m,x,y); p.info= statistics(p.info,S); %if ~MD.Status | (nargin>1 & ChangeModel) p.info= status(p.info,1); %end else chead= colhead(m); S= NaN(size(chead)); p.info = statistics(p.info,S); p.info= status(p.info,0); end if ~isempty(obj.UpdateFcn) obj.UpdateFcn(); end delete(obj); case 'cancel' set(obj.figure, 'Visible', 'off'); doButtonCallback(obj,'clear'); delete(obj); end