MATLAB: How to deal with this error?

for loopWavelet Toolbox

When i write the code i get *The variable'DG4' appears to change size on every loop iteration(within a script). Consider preallocating for speed
What should i do??
t4=122;
n4=2000;
for i=1:n4
if abs(d4(i))>t4
DG4(i)=d4(i)-((t4.^2)/d4(i));
end
end
d4 is a signal of 1×2000 double

Best Answer

At the beginning of the code, write
DG4=zeros(1,2000);