title: Matlab: Update waitbar without drawing plot
body: <p>I'm trying to plot lots of single lines with different length. Therefore, I use a rather simple code:</p>
  
  <pre><code>p = csvread('C:\path\file.csv',2,0,[2,0,1000000,3]);
  h=waitbar(0,'Plotting...');
  for r=1:size(p,1)
      waitbar(r/size(p,1),h);
      r0=r;
      t0=p(r0,4);
      while(r&lt;=size(p,1) &amp;&amp; p(r,4)==t0)
          r=r+1;
      end
      plot(p(r0:r-1,2),p(r0:r-1,3));
      hold on
  end
  close(h);
  </code></pre>
  
  <p>This code iterates through each line of my csv file and plots the lines from <code>r0</code> to <code>r-1</code> for which <code>p(r,4)</code> stays constant. I am not interested in seeing every single line being plotted, so I want Matlab to plot everything in the background and show me the result afterwards. Since that plotting takes quite some time, I'd like to see my waitbar updating while plotting in the background.</p>
  
  <p>But there's a problem: everytime the waitbar updates, the plot is drawn (similar to the <code>drawnow</code> command). This takes A LOT of time compared to drawing in the background. <strong>How can I update my waitbar without drawing the plot?</strong></p>