title: MATLAB Speed Difference in Identical Code
body: <p>I have some MATLAB code I've been working with. There are three sections, say A, B, and C. A and C can change, B stays the same regardless.</p>
  
  <p>What I did was separate A, B, and C into separate .m files (not functions, just scripts). A just creates a set of variables, B contains the logic, and C contains plotting for the results. I'll call D a file where all I've done is linearly copy/paste the entire contents of A, B, and C right after each other.</p>
  
  <p>If I run A, then B, then C, the iteration within B goes VERY SLOWLY, about 15 seconds per iteration.
  If I run D (just A then B then C pasted in) it goes FAST, about 2 seconds per iteration.</p>
  
  <p>Given that MATLAB is running the exact same code in the exact same order, why would the two have such drastically different execution times?</p>