If you use the same variable name it replaces that name it does not add onto that array internally illustration. At the end i should have 10x1000000 matrix in z mat and my variable out should hold only 1x1000000 vector during each iteration at a time. Whos file new mat.