title: Faster version of find for sorted vectors (MATLAB)
body: <p>I have code of the following kind in MATLAB:</p>
  
  <pre><code>indices = find([1 2 2 3 3 3 4 5 6 7 7] == 3)
  </code></pre>
  
  <p>This returns 4,5,6 - the indices of elements in the array equal to 3. Now. my code does this sort of thing with very long vectors. The vectors are <em>always sorted</em>.</p>
  
  <p>Therefore, I would like a function which replaces the O(n) complexity of find with O(log n), at the expense that the array has to be sorted.</p>
  
  <p>I am aware of ismember, but for what I know it does not return the indices of all items, just the last one (I need all of them).</p>
  
  <p>For reasons of portability, I need the solution to be MATLAB-only (no compiled mex files etc.)</p>