title: Correct way of extracting indices and values of non-NaN elements in an array
body: <p>I have a data array with numbers and NaN elements. I would like to get 3 vectors with the indices and the respective values of the non-NaN elements of this array.</p>
  
  <p>Here is how I do it:</p>
  
  <pre><code>[x,y]=find(~isnan(A));
  [~,~,z]=find(A(~isnan(A)));
  </code></pre>
  
  <p>Now, this is not optimal. First the size of <code>z</code> differs from the size of <code>x</code> and <code>y</code> (it is one element shorter, and I don't know which one has been omitted). Second, I'm sure it's possible to do both in one line.</p>