MATLAB: Using strrep on cell array with some non-chars

strrep

Hi all.
I have this set of data structured as an array of cells which contain chars in almost all cells. However, a few cells contain NaN as double.
Now, I want to use the function 'strrep' on this array of cells as I need to exchange ',' and '.'.
Does anyone have an efficient solution to this?
Thanks a lot

Best Answer

C = {'1,2', NaN, '3,14'};
isString = cellfun('isclass', C, 'char');
C(isString) = strrep(C(isString), ',', '.');