title: Find where the difference of vector is larger than 1
body: <p>I can't figure out why this bit of code isn't working: </p>
  
  <p>I have a vector j like this </p>
  
  <blockquote>
    <p>j=[1;2;4;13;14;19;20]    </p>
  </blockquote>
  
  <p>I am trying to do</p>
  
  <pre><code>for i=2:7
      j1=find(j(i)==(j(i-1)+1)
  end
  </code></pre>
  
  <p>This should give me a j1 of [2,5,7] right? For some reason it's giving me a j1 of either [1] or [0]</p>
  
  <p>Any help would be greatly appreciated, also I am not tied to using find. I just need the indices of j where there is a discontinuity, i.e. for the j I posted it should tell me where it jumps from 1,2 to 4 and from 4 to 13,14 etc. </p>