title: Find values in a matrix and put them into a vector
body: <p>It must be simple, but surprisingly I couldn't find an answer to this problem here or by trial-and-error.<br>
  I want to get values out of a matrix (according to some condition) and place the values into a vector.  I also need the subscript indices of the matching values.  There is a lot of data so for loops are out.  </p>
  
  <p>This is a correct (but iterative) answer:  </p>
  
  <pre><code>[I,J] = find(A &gt; 5);
  values = zeros(numel(I),1);
  for i=1:numel(I)
      values(i) = A(I(i),J(i));
  end
  </code></pre>
  
  <p>I tried <code>values = A(I,J)</code> but this is n-by-n instead of n-by-1.</p>