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

    function maxncenters = calcMaxNCenters(m,maxCStr,nObs)
%CALCMAXNCENTERS

%  Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.



% calculates the maximum number of centers, given an xregoptmgr evalstr 
% supports the old version when evalstr is a double

if isa(maxCStr,'double')
	maxncenters= maxCStr;
else
	try
		maxncenters = eval(maxCStr{1});
	catch
		maxncenters = eval(maxCStr{2});
		warning(message('mbc:xregrbf:InvalidArgument', maxCStr{ 2 }))
	end
end
% round to the nearest integer, and ensure it is greater than one and less than N
maxncenters = min(max(round(maxncenters),1),nObs);