title: Using find for searching into the same array
body: <p>I'm doing a project in MATLAB and I have a question about the <code>find</code> command.</p>
  
  <p>I have an array (<code>maxes</code>) which contains data stored in two columns (time and frequency). Each row represent the frequency-time pair of a point. </p>
  
  <p>I want to pair those values that meet certain conditions (that its frequency doesn't differ in more than 32 units and that its time doesn't differ in more than 64). I've thought of using the <code>find</code> command, but I don't know how to make it search for coincidences inside the same array. Is it possible? How can I do it?</p>
  
  <p>In case I haven't explain my objective clearly (sorry if my English is bad, it's not my mother tongue), I leave here the code I've done for executing that part. It works perfectly, but it uses two <code>for</code> loops and I want to how it will work more efficiently using the <code>find</code> command.</p>
  
  <pre><code>for i = 1:length(maxes)-1
      f1 = maxes(i,1);
      t1 = maxes(i,2);
      for j = i+1:length(maxes)
          f2 = maxes(j,1);
          t2 = maxes(j,2);
  
          if((t2 - t1) &lt; 64 &amp;&amp; (t2 &gt; t1))
              if(abs(f2 - f1) &lt; 32)
                  count = count+1;
                  Lrow = [t1, f1, f2 - f1, t2 - t1]; 
                  L(count,:) = Lrow;
              end
          else break;
          end
      end
  end
  </code></pre>
  
  <p>Thank you so much in advance for your help</p>