Look at the function "zeros".
array = zeros(1,5);
newArray = zeros(1,5*p);
and, in the loop
This way all you need is allocated before the loop.
I assume that the assignments of a through e come from function that have a different value for different i's.
If they are the same, it's just a tiling problem. You need "repmat".