title: Cut data off and plot in MATLAB
body: <p>I have a data file with 2300 data points. The data fluctuates between -0.1 to 0.1
  I want to plot portions of the plot before it hits the value 0.1 again. For example:
  if the first point is 0.1 then plot it till it hits 0.1 again and then stop..
  and do the same after again . So, far I haven't been able to achieve that. Any help would be appreciated.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>G_Data = load('sample3.txt');
  time = G_Data(:,1);
  Ax = G_Data(:,2);
  Ay = G_Data(:,3);
  Az = G_Data(:,4);
  
  %% Data parsing
  ind = find(Az&lt; 0.1&amp; Az&gt;-0.1);
  nAz = Az(ind);
  ntime = time(ind);
  figure
  plot(ntime,nAz)
  
  %plot(ntime(1:197),nAz(1:197))'
  </code></pre>
  
  <p>I want the number (197) in this case because that is where first time the data set hits the value of about 0.1 to be found by the code.</p>
  
  <p><em>This is the current plot:</em></p>
  
  <p><img src="https://i.stack.imgur.com/gKDjW.jpg" alt="current"></p>
  
  <p><em>This is the desired plot:</em></p>
  
  <p><img src="https://i.stack.imgur.com/hA9bR.jpg" alt="desired"></p>
  
  <p>Here is the link to the data file 
  <a href="http://www.filedropper.com/sample3" rel="nofollow noreferrer">DataFileTest</a></p>