MATLAB: Loop is killing proccesor.

loop

I am running the code below where I am trying to create a matrix for all the products of x digit numbers. Works fine for 1 and 2 digit numbers but three kills it. I have taken the semi colon off of 'z' and also 'x' in the first if statement so I can watch the output. For the first hundred loops (999 to 900) it is fast then gets progressively slower. The same number of tasks are being done each loop, so where my problem must be in loading the answers onto the end of my matrix 'NumLine'. Is this my problem?
function palout =paladin(numDig)
%NumLine = ((10^(numDig-1)^2):((10^numDig)-1)^2);
xMax = 10^numDig-1; %Upper bound
x = xMax;
y = x;
z = 10^(numDig-1) %Lowwer bound
NumLine = [];
while x >= z
NumLine(end+1) = x*y;
if y == z
x = x-1
y = xMax;
else
y = y-1;
end
end
palout = NumLine;

Best Answer

yes, you need to pre-allocate NumLine