www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregoptmgr/fitproperties.m
function p = fitproperties(om,p) %FITPROPERTIES % % p = fitproperties(om,p) % Copyright 2006-2009 The MathWorks, Inc. persistent LT if isempty(LT) % lookup structure to convert parameter names of optmgrs LT.alpha = 'ConfidenceLevel'; LT.MaxNCenters = 'MaxCenters'; LT.NTrials = 'Trials'; LT.NZooms = 'Zooms'; LT.LoWidth = 'MinWidth'; LT.HiWidth = 'MaxWidth'; LT.nTestValues = 'NumberOfLambdaValues'; LT.MaxNParams = 'MaxParameters'; LT.StartLamUpdate = 'StartLambdaUpdate'; end if iscell(om.algorithm) if ischar(om.algorithm{2}) BaseName= om.algorithm{2}; else BaseName= func2str(om.algorithm{2}); end else BaseName = om.name; end if ~isempty(om.Context) ID = [om.Context,'_',BaseName]; else ID = BaseName; end ID = strrep(ID,' ',''); ID = strrep(ID,'-',''); [p,OK] = PersistentStore(p,ID); if ~OK for i=1:length(om.foptions) f = om.foptions(i); if f.GuiSetable OrigProp = f.Param; prop = f.Param; try % change property names through a look up structure prop = LT.(prop); end % copy checks so the checks get reported by mbcmodel.properties % rather than xregoptmgr Check = f.CheckInput; if ~iscell(f.CheckInput) Check = {Check,[]}; end if length(Check)>2 % There was a bug with min press -see G177127 Check = Check(1:2); end if strcmp(Check{1},'xregoptmgr') Check{1} = 'mbcmodel.fitalgorithm'; end % add property to mbcmodel.fitalgorithm p = addprop(p,prop,... @( om ) get( om, OrigProp, false, false ),... @( om,v) set( om, OrigProp,v, false, false ),... Check{:},f.Name); end end PersistentStore(p,ID); end