gusucode.com > 十大算法matlab程序说明 > 十大算法matlab程序说明/遗传退火法/fcnvectorizer.m

    function y = fcnvectorizer(pop,varargin)
%FCNVECTORIZER is a utility function used for scalar fitness functions.

%   Copyright 2003-2004 The MathWorks, Inc.
%   $Revision: 1.6.4.1 $  $Date: 2004/08/20 19:48:59 $


if nargin < 2  
    error('gads:FCNVECTORIZER:numberOfInputs','FCNVECTORIZER requires at least 2 inputs');
end

temp = feval(varargin{1},pop(1,:),varargin{2:end});
if length(temp) ==1 && ~isobject(temp)
    y    = repmat(temp,size(pop,1),1);
    for i = 2:size(pop,1)
        y(i) = feval(varargin{1},pop(i,:),varargin{2:end});
    end
else %This custom type must be a vectorized call
    y = feval(varargin{1},pop,varargin{2:end});
end