title: Find vector elements matching two conditions in Matlab
body: <p>I have a vector <code>a = [1 5 3 4 2]</code>. I'd like to find all elements of a, which are <code>1&lt;a&lt;5</code>. How do I do it in Matlab? </p>
  
  <p>Personally I've developed one solution, but it's cumbersome:</p>
  
  <pre><code>a = [1 5 3 4 2];
  ix = find(a&gt;1);
  ix = ix(find(a(ix)&lt;5));
  disp(a(ix))
  </code></pre>
  
  <p>What's a better way?</p>