www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@xregdesign/SpaceFillDesign.m
function [d,ok]=SpaceFillDesign(d,cs,action,opt) % SPACEFILLDESIGN interface for setting a space filling design % % D=SpaceFillDesign(D, CSET,[ACTION],[OPT]) sets the design to consist of % the points in CandidateSet CSET, and marks the design as % a classical design of the appropriate type. % % ACTION is an optional argument: ACTION='replace'/[] deletes all of the % current design points. ACTION='add' keeps all of the current points % and adds the new ones on top. ACTION='replacefree' keeps all of the % fixed design points and deletes the free ones. % OPT is an optional argument. If OPT='constrain' then the design % points are run through the design's constraints object before being set. % % The default action is to replace all the points. The default for OPT is % to NOT constrain the points. % % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. % Created 9/1/2001 if nargin<4 opt=''; elseif nargin<3 | isempty(action) action='replace'; end [fullnm, nm, tp]=CandidateSetInformation(cs); if (tp~=1) error(message('mbc:xregdesign:InvalidArgument1')); end if nfactors(cs)~=nfactors(d) error(message('mbc:xregdesign:InvalidSize1')); end % get points and transfer to design object pts=fullset(cs); if strcmp(opt,'constrain') & ~isempty(d.constraints) c=reset(d.constraints); %Old form:>> [c,in]=eval(c,pts); [c, in] = isInside( c, invcode( model( d ), pts ) ); pts=pts(in,:); end switch action case 'replace' [d,ok]=reinit(d,pts,'defined'); d.style.base=2; d.style.baseinfo=cs; case 'add' d=augment(d,pts,'points'); ok=rankcheck(d); case 'replacefree' d=deletefreepoints(d); d=augment(d,pts,'points'); ok=rankcheck(d); end return