When plotting a set of figures using a for loop, for example:
for ei=1:length(E), hnds(ei) = plot(1:nP, avgR(ei,:), [clrStr(ei),'-'] ); end
There is a (the famous) warning in the code for the hnds(ei) variable:
The variable hnds(ei) appears to change size on every loop iteration. Consider pre-allocating for speed.
But when I try to pre-allocate the variable:
hnds = zeros(1,length(E));
there is another warning for this new line and in the details for pre-allocation it says:
Suggested Action: Avoid preallocating memory to a variable assigned to the output of another function.
Is there any way to remove this warning, or should just ignore it?