title: matlab remove NaN from matrix
body: <p>I have a matrix:</p>
  
  <pre><code>raw = 
  
  'alon'     'tomer'    'ilana'    'T1'     '2'      '53'      '24'       'NaN'
  'ilana'    'oren'     '6'        'a'      'g'      'g'       'gsh'      'NaN'
  'dikla'    'aba'      'mama'     'a'      'h'      'ghfs'    'bfsbf'    'NaN'
  '4'        'NaN'      'NaN'      'nn'    'NaN'    'NaN'     'hadhd'    'NaN'
  </code></pre>
  
  <p><strong>and I want to remove NaN and to get:</strong></p>
  
  <pre><code>    'alon'     'tomer'    'ilana'    'T1'     '2'      '53'      '24'
      'ilana'    'oren'     '6'        'a'      'g'      'g'       'gsh'
      'dikla'    'aba'      'mama'     'a'      'h'      'ghfs'    'bfsbf'
      '4'         ''        ''         'nn'     ''       ''        'hadhd'
  </code></pre>
  
  <p>how do I do that?</p>
  
  <p>I tried a lot of suggestions, but I got errors:</p>
  
  <p>1)</p>
  
  <pre><code>&gt;&gt; raw=raw(~isnan(raw(:,2)),:)
  ??? Undefined function or method 'isnan' for input arguments of type 'cell'.
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>raw(isnan(raw(:,1)),:) = [];
  ??? Undefined function or method 'isnan' for input arguments of type 'cell'.
  </code></pre>
  
  <p>3)</p>
  
  <pre><code>raw(~any(isnan(raw),2),:)
  ??? Undefined function or method 'isnan' for input arguments of type 'cell'.
  </code></pre>
  
  <p>4)</p>
  
  <pre><code>T(cellfun(@isnan,T))={0}
  ??? Error using ==&gt; cellfun
  Non-scalar in Uniform output, at index 1, output 1.
  Set 'UniformOutput' to false.
  </code></pre>
  
  <p>I tried Ansari's solution, but now I got:</p>
  
  <pre><code>raw = 
  
  'alon'     'tomer'    'ilana'    'T1'    '2'    '53'      '24'       [0]
  'ilana'    'oren'     '6'        'a'     'g'    'g'       'gsh'      [0]
  'dikla'    'aba'      'mama'     'a'     'h'    'ghfs'    'bfsbf'    [0]
  '4'        [    0]    [    0]    'nn'    [0]    [   0]    'hadhd'    [0]
  </code></pre>
  
  <p>it's not good for me, because I want to do:</p>
  
  <pre><code>size(raw,2) 
  </code></pre>
  
  <p>and to get:</p>
  
  <p>7</p>