Looping statements performance and pre-allocating the looping statement itself
This observation is not that important, because the time performance wasted on the loop statements will probably be much higher than the looping itself. But anyway, I will share it since I searched and couldn't find a topic about this. I always had this impression that pre-allocating the array I would loop, and then loop on it, would be better than looping directly on it, and decided to check it. The code would be to compare the efficiency between this two fors: disp('Pure for with column on statement:') tic for k=1:N end toc disp('Pure for with column declared before statement:') tic m=1:N;