⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort.m

📁 一些用matlab编写的经典遗传算法算例 挺有用的
💻 M
字号:
function varargout = sort(chr)
% SORT - Sort in ascending order.  For a vector of chromosomes, sort(x)
%    sorts the objects of x in ascending order, with the respect to
%    the fitness of the chromosomes. 
%    [y i] = sort(x) also returns an index vector.
for k=1:length(chr)
  tmp(k)=chr(k).fitness;
end
[q ind]=sort(tmp);
varargout{1}=chr(ind);
varargout{2}=ind;

⌨️ 快捷键说明

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