Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
HOW TO RESOLVE "index exceeds matrix dimensions matlab"?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
??? Index exceeds matrix dimensions.
Error in ==> GA at 191
firstKids(masks)=secondParents(masks);
-------------------------------------------------
reprodIndices=rand(popSize/2,1)<1-probCrossover; masks(reprodIndices,:)=false; firstKids=firstParents; firstKids(masks)=secondParents(masks); secondKids=secondParents; secondKids(masks)=firstParents(masks); pop=[firstKids; secondKids];
0 commentaires
Réponses (1)
Walter Roberson
le 24 Juin 2017
You must have initialized masks before this code or else the assignment of false would have ended up with an all-false matrix. But we do not know what size you initialized to or how that size compares to the your Parents matrices.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!