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

    function obj = generate(obj)
%GENERATE Generate the candidateset.
%
%   OBJ = GENERATE(OBJ) will re-generate the LHS point set.  This
%   generation happens automatically when properties are changed, unless
%   the 'doRecalc' property has been set to 0.
%
%   See also: ISGENERATED, RESET.

%   Copyright 2007 The MathWorks, Inc.

stratlvls = obj.stratify_levels;
if any(obj.stratify)
    tpflg = 3;  % require doubles for accuracy
    % convert stratify levels into 1...N domain
    lims = limits(obj);
    for k = find(obj.stratify==-1)
        stratlvls{k} = ((obj.N-1) .* (stratlvls{k}-lims(k,1))./(lims(k,2) - lims(k,1))) + 1;
    end
else
    % Decide which storage class to use for the indices
    if obj.N<=255
        tpflg=0;
    elseif obj.N<=65535
        tpflg=1;
    elseif obj.N<=4294967295
        tpflg=2;
    else
        tpflg=3;
    end
end
if obj.doRecalc
    % Use the number in this property as the number of permutations
    nP = obj.doRecalc;
else
    nP = 500;
end
obj.indices=pr_selectlhs(obj,obj.N, nfactors(obj), tpflg, obj.alg, obj.optimalg,obj.guiflag,nP,...
    obj.stratify,stratlvls,obj.symmetry);