www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregoptmgr/setdefaults.m
function OM= setdefaults(OM,Properties,ctxt) %SETDEFAULTS % Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin==1 Properties= {OM.foptions.Param}; end if ischar(Properties) % make into cell Properties= {Properties}; end opts= {OM.foptions.Param}; if nargin<3 omdef= i_buildOM(OM); else omdef= i_buildOM(OM,ctxt); end for i=1:length(Properties); pind= find( strncmpi( Properties{ i },opts,length(Properties{ i }) ) ); if isempty(pind) error(message('mbc:xregnnet:InvalidProperty1')) elseif length(pind)>1 pind= find( strcmpi( Properties{ i },opts ) ); if isempty(pind) error(message('mbc:xregnnet:InvalidProperty2')) end end if isa(OM.foptions(pind).Value,'xregoptmgr'); alts= OM.foptions(pind).Value.Alternatives; OM.foptions(pind).Value= omdef.foptions(pind).Value; % copy alternatives OM.foptions(pind).Value.Alternatives= alts; else OM.foptions(pind).Value= omdef.foptions(pind).Value; end end function [omdef]= i_buildOM(om,ctxt) if nargin<2 ctxt= feval(om.Context); end if isa(om.algorithm,'cell') % context algorithm omdef= feval(om.algorithm{2},ctxt); elseif ~strcmp(om.algorithm,'contextImplementation') try omdef= xregoptmgr(om.algorithm,ctxt); catch omdef= om; warning(message('mbc:xregnnet:InvalidState')) end else omdef= om; end