title: Set axes limits in Matlab GUI
body: <p>I am trying to simulate a real time plot of an ECG signal using MATLAB GUI. For testing purposes I am trying to implement a sine wave that plots as if in real time. I am using a GUI with one button which starts plotting the sine wave, and a set of axes tagged as 'axes1'. The code below is extracted from the callback function for the start button:</p>
  
  <pre><code>%create a sine wave to plot
  X=[0:0.1:25*pi];
  X=transpose(X); 
  Y=sin(X); 
  [a,b] = size(X); 
  hold on; 
  %initialise axes limits
  axis(handles.axes1,[0,a,-1,1]);
  %plot sine wave 
  for i = 1:a 
  plot(handles.axes1,1:i,Y(1:i)); 
  drawnow; 
  pause(0.01); 
  end
  </code></pre>
  
  <p>The result is a moving sine wave, but I am trying to define the axes limits beforehand so that they don't keep re-sizing as the wave is plotted. I have tried using the line</p>
  
  <pre><code>axis(handles.axes1,[0,1,-1,1])
  </code></pre>
  
  <p>To set the axes limits but it is not working as I would like it to and I'm not sure how to proceed from this point. </p>
  
  <p>Thanks in advance for any help!</p>