I had a problem with this script when my cell array had a row with strings: all the values were written as 'NA', supposedly because they didn't verify the conditions from all the elseif's of StringX(x).
If I deleted the last else it would give me an error: "Error using sprintf
Function is not defined for 'cell' inputs."
So I changed the last else from
x = 'NA';
x = char(x);
And it worked. No more 'NA'.
Thank you for your script. Good work ;)
I modified according to Justin and Jan's suggestions. And also added support for row vector. It is much faster now. See the updated file at http://www.mathworks.com/matlabcentral/fileexchange/47055-cell2csv-m
credits go to Sylvain.