MATLAB: Save serial datenum as decimal, not scientific notation

datenum

Hello,
I'm reading in a csv file containing timestamps as serial numbers. After some computation, I need to save the array back as a csv file. However, when importing, Matlab converts the decimal datenums into scientific format, i.e. 737389.4167 becomes 7.3739e+05 and they're stored in that format. I know this is the case because when I subsequently import the data in Excel, the format is different between original and edited file. This causes problems when importing the files into
I tried to work around it by converting it in str and cells, but that creates other problems when saving as csv.
Matlab R2018a
[file,path] = uigetfile('*.csv');
fn = fullfile(path,file);
A = csvread(fn);
[filepath,filename,ext] = fileparts(fn);
fnout=fullfile(path,strcat(filename,'_edited',ext));
csvwrite(fnout,A)
Any help is really appreciated as this has created a lot of headaches.

Best Answer

Ok, dlmwrite instead of csvwrite seemed to fix it. So here's what I'm using instead, now:
[file,path] = uigetfile('*.csv');
fn = fullfile(path,file);
A = csvread(fn);
[filepath,filename,ext] = fileparts(fn);
fnout=fullfile(path,strcat(filename,'_edited',ext));
dlmwrite(fnout,A,'precision',15)
Related Question