MATLAB: Extract numbers from cell array

cell arraysdouble

Hi,
I have a cell array with both numbers and 'NA' strings for missing values.
Now I want to convert the cell array to a pure number array to use it for calculations, keeping all numbers and setting the 'NA' to NaN.
What would be the easiest way to achieve that?
Best regards,
Chris

Best Answer

A(cellfun(@ischar,A)) = {NaN};
Amat = cell2mat(A);