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

    function [csout,ok] = propedit(cs,varargin)
%PROPEDIT Edit the properties for a CandidateSet object.
%
%  [CSOUT, OK]= PROPEDIT(CS,'prop','value,..)
%
%  Valid properties are - 'Name' : string to use for dialog title
%                         'Model': model object to use for coding
%                         'Help' : string to use as a help button tag

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


% Process input arguments
nm = [];
mdl = [];
help = '';
if nargin>1
    for n = 1:2:nargin-1
        switch lower(varargin{n})
            case 'name'
                nm = varargin{n+1};
            case 'model'
                mdl = varargin{n+1};
            case 'help'
                help = varargin{n+1};
        end
    end
end

if isempty(nm)
    nm = [CandidateSetInformation(cs) ' Design Properties'];
end
if isempty(mdl)
    mdl = xregmodel('nfactors',nfactors(cs));
end
if isempty(help)
    Buttons = 'OK_CANCEL';
else
    Buttons = 'OK_CANCEL_HELP';
end
% Create dialog
dlg = mbcgui.container.Dialog('Name', nm, ...
    'Size', [370 350], ...
    'HelpCode', help, ...
    'Buttons', Buttons);
fig = dlg.Figure;

% Create property editing layout for the object
ptr = xregpointer(cs);
lyt = propertypage(ptr.info,'layout',fig);
propertypage(ptr.info,'update',lyt,ptr,mdl);
dlg.Content = lyt;

Result = dlg.showDialog();

if strcmp(Result,'OK')
    ok = 1;
    propertypage(ptr.info,'finalise',lyt);
    csout = ptr.info;
    if ~isGenerated(csout)
        csout = generate(csout);
    end
else
    ok = 0;
    csout = cs;
end
freeptr(ptr);
delete(dlg);