我在下面运行这个程序,我不断收到错误“索引超出矩阵尺寸”的行“Tour1 = pop(kk(1:10),:);”。我不知道我错过了什么。任何人都可以帮忙吗?谢谢
for i = 1:100 %Population Initialization
pop(i,1) = 50 - rand*(50-1);
pop(i,2) = 1 - rand*(1-0.1);
pop(i,3) = 0.2 - rand*(0.2-0.01);
Kc(i) = pop(i,1);
T1(i) = pop(i,2);
T2(i) = pop(i,3);
fitness(i) = obj(Kc(i), T1(i), T2(i));
%% TOURNAMENT SELECTION
for j = 1:10 %Select first parent
kk = randperm(100);
Tour1 = pop(kk(1:10),:);
temp1 = mat2cell(Tour1(j,:),1,ones(1,numel(Tour1(j,:))));
ZET1(j) = obj(temp1{:});
end
[Val1 Ind1] = max(ZET1);
parent1 = Tour1(Ind1,:);
end