title: Matlab Anonymous Function If Else
body: <p>In MATLAB I am trying to do a function on a cell array, but am not having much luck. I would like to create a <code>cellfun</code> which checks whether <code>str2double</code> returns <code>NaN</code> values and then perform the <code>str2double</code> on the values which aren't <code>NaNs</code>. I'm trying to use an anonymous function with an IF Else sort of statement in it but not really getting anywhere. Here is what I have come up with so far:</p>
  
  <pre><code>x = cellfun(@(x)~isnan(str2double(x)),str2double(x))
  </code></pre>
  
  <p>However it doesn't work, could anybody help me out?</p>