www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@xregdesign/gui_predef.m

    function [dout,ok] = gui_predef(d,cs)
%GUI_PREDEF GUI for choosing the options of a pre-defined design.
%
%   [DOUT,OK]=GUI_PREDEF(D,CS) invokes a dialog editing or choosing a
%   pre-defined design (classical/space-filling). CS is a
%   function handle for the constructor of a candidateset.  In this case
%   the user will be given a dialog for editing the properties of the
%   design. 

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


if nargin<2
    error(message('mbc:xregdesign:TooFewInputs'));
end

if npoints(d)
    % do an add/overwrite dialog
    [action,ok]=designAugmentReplaceGUI(d);
    if ~ok
        dout=d;
        return
    end
else
    action=1;
end

% Decide which option to go for

% String/fcn handle to a candidateset subclass.  This shows the property
% editing page just for the specified class.
% Take the default limits from current model
tgt = gettarget(model(d));
prnt = candidateset(tgt);
cs = feval(cs,prnt);

% Get current design style, if it exists.  If this matches the
% specified one then the existing style is used in place of it.
[s,info] = getstyle(d);
if (s==2 || s==3) && strcmp(class(info),class(cs))
    % Ensure point sets are reset if we are using an existing one.
    cs = reset(info);
end

[~,~,tp] = CandidateSetInformation(cs);
if tp==2
    helptag = 'xreg_desClassical';
elseif tp==1
    helptag = 'xreg_desSpaceFill';
else
    helptag = '';
end

[cs,ok] = propedit(cs, 'model', model(d), 'help', helptag);


% Use the new candidate set or do a no-op
if ~ok
    dout = d;
else
    ActionStrs = {'replace', 'add', 'replacefree'};
    [~,~,tp]= CandidateSetInformation(cs);
    if tp==2
        dout = ClassicDesign(d,cs,ActionStrs{action},'constrain');
    elseif tp==1
        dout = SpaceFillDesign(d,cs,ActionStrs{action},'constrain');
    end
end