MATLAB: Replacing NaN with some specific values in a mix data type of cell.

cellMATLABnan

Hi there, I'm looking for functions that can replace Nan with some specific values in a mix data type of cell. Mix data type as in there's some cell containing strings, some are containing num.
I tried using
table(cellfun(@isnan,table))={'0'}
and I got this
Error using cellfun
Non-scalar in Uniform output, at index 1, output 1.
Set 'UniformOutput' to false.
Please help. Thanks!

Best Answer

Start with a simple loop:
for iC = 1:numel(C)
aC = C{iC};
if isfloat(aC) && ~isempty(aC) % Only SINGLE and DOUBLE can be NaN
aC(isnan(aC)= 0;
C{iC} = aC;
end
end