So, I\'ve recently started using Matlab\'s built-in profiler on a regular basis, and I\'ve noticed that while its usually great at showing which lines are taking up the most
When I've seen this in my code, it's been the deallocation of large temporaries created in the loop. Each new variable created in the loop is deallocated at the end.