If you wish to simply write the data to a text file without loss of precision, then try something like
if fileID>0
for k=1:size(cellArray,1)
for m=1:size(cellArray,2)
dataType = class(cellArray{k,m});
if strcmpi(dataType,'char')
fprintf(fileID,'%s\t',cellArray{k,m});
elseif strcmpi(dataType,'double')
fprintf(fileID,'%.10f\t',cellArray{k,m});
end
end
fprintf(fileID,'\n');
end
fclose(fileID);
end
By using the %.10f we are requesting that ten digits beyond the decimal place be written to file.
Best Answer