title: Matlab Plot that changes with time
body: <p>I am trying to plot a figure that changes with time (think of it as plotting the shape of a pole as the wind passes through it, so I want to plot the shape at every second).</p>
  
  <p>To avoid the x axis limit changing frequently I want to fix it to the limits (max and min that I calculate before plotting). Here is a sample of my code:</p>
  
  <pre><code>for i=1:1:numberofrows
      momentvaluesatinstant = momentvalues(i,:);
      figure(1)
      plot(momentvaluesatinstant,momentheader)
      drawnow
      title(sprintf('Moment profile along pile at time 0.2%f',time(i)'))
      xlabel('Moment (kN.m)')
      xlim([momentvalues(rowminmoment) momentvalues(rowmaxmoment)])
      ylabel('Length of pile (m)')
      delay(1);
  end
  </code></pre>
  
  <p>Although I am specifying the limits of the x axis to be fixed to the values I specify, the plot keeps changing the limits depending on the data being plotted? Is there something I am missing?</p>