impfit.m

来自「一些经典遗传算法问题的matlab程序调度问题分配问题等等」· M 代码 · 共 19 行

M
19
字号
function fitness = impfit(fname)
% IMPORT - imports the fitness from a file
%   fitness = impfit('fname') where fname is the name of the
%   file. The order of the fitness is the same as the order of the
%   chromosomes sent to evaluation.
% 
% See also EXPORT
res=[];
fid=fopen(fname);
while 1
  tmp=fgetl(fid);
  if ~ischar(tmp)
    break
  else
   res=[res str2num(tmp)];
  end
end
fitness=res;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?