www.gusucode.com > matlab编程遗传算法计算匹配电路源码程序 > code1/code/MATLAB源代码/check_match_chrom.m

    function [ NewChrom ] = check_match_chrom(OldChrom,num_integer)
%UNTITLED 此处显示有关此函数的摘要
%   此处显示详细说明
NewChrom=OldChrom;
[Nind,~]=size(OldChrom);
for k=1:Nind
    count=0;
    y=zeros(1,num_integer);
    for i=1:num_integer
        if OldChrom(k,i)>8
            count=count+1;
            y(count)=i;
        end
    end
    if count>1
        x=ceil(count*rand);
        temp=OldChrom(k,y(x));
        for i=1:count
            NewChrom(k,y(i))=floor(9*rand);
        end
        NewChrom(k,y(x))=temp;
    end
end

end