Problem in crossover of parents
1 view (last 30 days)
Show older comments
I want to cross over 2 parents at point 3.
parent1=1011
parent2=1100
child=1010
i want the child to take the first 3 bits from parent1 and the last bit from parent2. i wrote this code but it says that index exceeds number of array elements.
CrossoverIndex =randi([1 3]);
child= [parent1(1:CrossoverIndex) parent2(CrossoverIndex+1:end)];
can someone please guide me?
0 Comments
Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!