Increasing the size of an array incrementally is a TERRIBLE thing to do. WHY?
Every time you add a new element to the end of the array, the vector becomes one element longer. So what does MATLAB need to do? It alocates a NEW array or vector of the new size. Then it copies the entire set of elements over. So every time, the array becomes larger and larger. And it takes more and more time to just add one more element. For vectors with many thousands of elements, this will become the largest source of time wasted in your code. A simple loop to create that vector might take days or weeks to create. Do NOT do this.
Instead, just preallocate the array to the final size. Then index into it. This will be incredibly fast and efficient. You will use a tool like zeros to perform the preallocation. I actually prefer to preallocate with the NaNs function, since then it shows me where the unused elements are. But the difference is trivial.
The only issue is if you don't know the final size. Then The best solution will arguably to just create a vector that is longer then you know it will need. When all is done, delete those last unused elements.
When you really have no clue how long your vector must be, and you cannot allocate something longer than you will need, there are tools I have provided on the file exchange to do this operation, to make it more efficient. They use tricks with cell arrays to avoid having to continuously reallocate new blocks of memory.