www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@fitalgorithm/CreateAlgorithm.m
function alg = CreateAlgorithm(OPT,Name) %CREATEALGORITHM Create algorithm % % alg = CreateAlgorithm(F,AlgorithmName); % AlgorithmName must be in the list of alternative algorithms given % by MBCMODEL.FITALGORITHM.GETALTERNATIVENAMES % % See also mbcmodel.fitalgorithm.getAlternativeNames, % mbcmodel.fitalgorithm.IsAlternative, mbcmodel.fitalgorithm.SetupDialog % Copyright 2006-2009 The MathWorks, Inc. Name = strrep(Name,' ',''); if ~isempty(OPT.Object) || nargin < 2 if isempty(OPT.Owner) AltList = getAlternatives(OPT.Object); else % call with owner object AltList = getAlternatives(OPT.Object,dataobject(OPT.Owner)); end AltNames = cellfun(@getname,AltList,'UniformOutput' , false); pos = find(strcmpi(Name,strrep(AltNames,' ',''))); if ~isempty(pos) obj = feval(xregGui.uddDispatcher,@mbcmodel.fitalgorithm,AltList{pos},OPT.Owner); alg = obj; else AltStr = sprintf('''%s'',',AltNames{:}); AltStr(end)= '.'; error(message('mbc:mbcmodel:fitalgorithm:InvalidAlgorithm', AltStr)); end else error(message('mbc:mbcmodel:fitalgorithm:InvalidAlgorithm1')); end