www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevproject/createTestplan.m
function T = createTestplan(MP,Inputs,NewName) %CREATETESTPLAN % % pTP= createTestplan(MP,Inputs,NewName) % Copyright 2006-2008 The MathWorks, Inc. if ~(numel(Inputs)==1 || numel(Inputs)==2) error(message('mbc:mdevproject:InvalidSizes')) end if iscell(Inputs) for i=1:length(Inputs) % make sure all elements are mbcinputfactor objects Inputs{i} = mbcinputfactor(Inputs{i}); end elseif isnumeric(Inputs) && all(Inputs==fix(Inputs)) switch length(Inputs) case 1 Inputs = {mbcinputfactor(Inputs)}; case 2 Inputs = {mbcinputfactor(Inputs(1),'L'),mbcinputfactor(Inputs(2))}; end else error(message('mbc:mdevproject:InvalidSizes1')) end switch length(Inputs) case 1 TPName = 'One-Stage'; case 2 TPName = 'Two-Stage'; end nf = length(Inputs{end}); % make test plan object T = mdevtestplan( TPName,xregCreateModel(@xregcubic,nf,'order',nf) ); try % set inputs T = setInputs(T,Inputs); catch ME % delete testplan from heap and rethrow error delete(T); rethrow(ME) end pTP= xregpointer(T); if pTP~=0 MP= AddChild(MP,pTP); if nargin>2 % Name new testplan pTP.name(NewName); end % Get the heap copy T = info(pTP); end