title: Cellfun is reordering my matrix when I try to clear the NaN's from it
body: <p>I am having some trouble with Matlab right now.  I am currently trying to remove all the NaN's from a large Cell Array I have 3806 x 122.  I have been looking at solutions from similar problems, and I came up with.</p>
  
  <pre><code>data(cellfun(@(x) any(isnan(x(:))), data)) = [];
  </code></pre>
  
  <p>My matrix is kind of weird because it looks like this</p>
  
  <pre><code>(ex).
  1    2    3    4    5    5    NaN
  6    5    2    5    6    7    NaN
  2    3    4    5    6    7    NaN
  NaN  NaN  NaN  NaN  NaN  NaN  NaN
  </code></pre>
  
  <p>My problem is when I apply the line of code above to my array I get an output of this with no NaNs.</p>
  
  <pre><code>1    2    3    4    5    5    6    5    2    5    6    7    2    3    4    5    6    7    etc...
  </code></pre>
  
  <p>I don't understand why it does this.  I also have to be careful with deleting the columns because each column has a corresponding title, and I don't want to mix them up.  It would be helpful if I could somehow index which columns and rows have the NaNs, so I could delete the corresponding the titles with them.</p>
  
  <p>In the end, I want to put the titles and data into a dataset structure that looks like this.</p>
  
  <pre><code>(ex).
  'title1'   'title2'   'title3'   'title4'   'title5'   'title6'
  1          2          3          4          5          5
  6          5          2          5          6          7
  2          3          4          5          6          7
  </code></pre>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Regards,
  Jonathan</p>