title: Matlab skipping plots (uncertainty)
body: <p>I have a sequence of finding fits for data (cd to folder, read and fit the data) and subsequently plotting them in a loop. </p>
  
  <p>I observe that few plots are done incorrectly, skipped and added in subsequent plots. A four second <code>pause</code> between each plots seems to solve this issue. </p>
  
  <p>I assume everything is sequential in Matlab, meaning subsequent commands wait until current command is finished. I believe this is not the way happening now. I believe using <code>pause</code> is not the best solution. Can someone provide a fix for this?</p>
  
  <p>A set of subsequent plots without the pause (solid line is a fit of datapoints on the fly):</p>
  
  <p><a href="https://i.stack.imgur.com/uUUjgm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uUUjgm.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/cSQWbm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cSQWbm.png" alt="enter image description here"></a></p>
  
  <p>The same plots with pause of 4 seconds:</p>
  
  <p><a href="https://i.stack.imgur.com/9CR5am.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9CR5am.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/i9Owqm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i9Owqm.png" alt="enter image description here"></a></p>