www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@cset_lhs/nfactors.m
function out=nfactors(obj,nf) % NFACTORS Get/set number of factors in candidate set % % NF=NFACTORS(OBJ) % OBJ=NFACTORS(OBJ,NF) % % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin>1 old_nf=nfactors(obj.candidateset); if nf<old_nf % cut out some dims if ~isempty(obj.indices) obj.indices=obj.indices(:,1:nf); end % Clear current point set as it is invalid obj = reset(obj); obj = pGeneratePoints(obj); elseif nf>old_nf % add some lattice dimensions if ~isempty(obj.indices) sz=size(obj.indices,1); for n=old_nf+1:nf obj.indices(:,n)=randperm(sz)'; end end % Clear current point set as it is invalid obj = reset(obj); obj = pGeneratePoints(obj); end obj.candidateset=nfactors(obj.candidateset,nf); % redo delta lims=limits(obj.candidateset); obj.delta=(diff(lims,1,2)')./obj.N; out=obj; else out=nfactors(obj.candidateset); end