www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregrbf/getMaxNCenters.m

    function [evalString, catchString] = getMaxNCenters(m)
%GETMAXNCENTERS Get the maximum number of centers for an RBF
%
%   N = GETMAXNCENTERS(M) is the maximum number of centers that the fit
%   algorithm for the given RBF, M, will use.
%
%   [EVALSTRING, CATCHSTRING] = GETMAXNCENTERS(M) returns the 'catch
%   string' as well as the 'eval string' for the maximum number of centers.
%   Because the maximum number of centers is stored as an xregoptmgr
%   'evalstr', the maximum number of centers will be returned as a string.
%
%   See also XREGRBF/SETMAXNCENTERS.

%   Copyright 2005-2011 The MathWorks, Inc.

if isempty(m.om)
    evalString = sprintf('%d',numParams(m));
    catchString = '';
else
    
    for name = {'MaxNCenters', 'MaxNumberCenters'}
        [nCenters,nFound] = get(m.om,name{1});
        if nFound == 1
            break
        end
    end
    % In this case we have correctly got the max number of centers option
    % out of the fit algorithm for the RBF. Now, the max number of centers
    % is stored as a "eval string". This means that getFitOpt will return a
    % cell-string such as {'75', 'min(nObs/4,25)'}. The first string is an
    % evaluation of the second string. We need to return the two strings to
    % the user.
    [evalString, catchString] = deal( nCenters{:} );
end