Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

while running a matlab program it shows error Subscript indices must either be real positive integers or logicals.

1 vue (au cours des 30 derniers jours)
balaji
balaji le 5 Sep 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
The program is given here
Let NP = population size =10;
D = Number of variables = 3;
pop = [2 4 6; 8 10 12; 5 10 15, 10 20 30; 33 22 11;3 6 9; 5 15 25; 12 24 30; 4 8 12; 8 16 20];
y is the population index that corresponds to best fitness
for np=1:NP
r1=round(unifrnd(1,NP));
while (r1==np)
r1=round(unifrnd(1,NP));
end
for j=1:D
newpop(np,j)=0;
newpop(np,j)=pop(np,j)+round(unifrnd(-1,1)*(pop(y,j)-pop(r1,j)));
end
end
  9 commentaires
Walter Roberson
Walter Roberson le 6 Sep 2015
We cannot run this, as ED is not defined. If it is an array then you are attempting to index the array at location 0.
We need to full error message showing exactly which line is triggering the error message for you.

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by