📄 sort.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 + -