sort.m

来自「多目标遗传算法/用法不用多说、要用的赶快下载吧」· M 代码 · 共 13 行

M
13
字号
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 + =
减小字号Ctrl + -
显示快捷键?