MATLAB: Replace NaN’s in a cell array with blanks (not empty char/string)

cell arraynan

Hello, I am using R2015. I am reading my data using xlsread. I have a cell array of numbers/strings and NaN's. I need to replace NaN's with blank cells (not empty char/string).
Thanks 🙂

Best Answer

mask = cellfun(@(C) isnumeric(C) && isscalar(C) && isnan(C), YourCell);
YourCell(mask) = {[]}; %guessing that "blank cells" means "empty array"