When I run the code it says the variable needs prealloaction.I am bulding masks here that will help me like constraints in a GA code.
Preallocating a variable that changes size every for loop iterations.
2 views (last 30 days)
Show older comments
I am using a variable indices that changes size like three times in an iteration .Preallocating it does not change anything.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365986/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365986/image.png)
See Also
Categories
Find more on Loops and Conditional Statements 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!