www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/setInputs.m
function m = setInputs(m,factorInfo,CopyTargets) %SETINPUTS -- set input information for a model % % M = SETINPUTS(FACTORINFO) % where FACTORINFO is a % NUMFACTORS % MBCINPUTFACTOR Array % CELL ARRAY NUMFACTORS by five cell array, creates a model with NUMFACTORS input % factors and sets the factor names, symbols, ranges and non-linear % transforms based on values of the FACTORINFO. % COPYTARGETS (default=false) uses targets from specified inputs % otherwise the model retains its current target. % Copyright 2006-2007 The MathWorks, Inc. if isa(factorInfo,'xregmodel') factorInfo = getInputs(factorInfo); else % make new input object factorInfo = mbcinputfactor(factorInfo); end nf = nfactors(m); if length(factorInfo)~=nf error(message('mbc:xregmodel:InvalidInput')); end if nf>0 if nargin>2 && CopyTargets m.Inputs = factorInfo; else % make sure target is set correctly for model m.Inputs = copyinputs(m.Inputs,factorInfo); end if ~isempty(getInternalModels(m)) % set ranges to target and no NonlinearTransform for internal models factorInfo= setcode(factorInfo,getRealTargets(m.Inputs),''); % update internal models m = updateInternalModels(m,@setInputs,factorInfo); end end