# pgfplots and matlab time format

What would be the best way to handle matlab time format with pgfplots? I have understood that pgfdateplot can only handle well `yyyy.mm.dd HH:MM` format but not seconds and especially nothing beyond that. How to plot data in `yyyy.mm.dd HH:MM:SS.SSS` format, but read it from the file that is in the matlab format:

``````time
7.364874167939814e+05
7.364874168184156e+05
7.364874168428498e+05
7.364874168672840e+05
7.364874168917182e+05
7.364874169161522e+05
7.364874169405864e+05
7.364874169650206e+05
7.364874169894548e+05
7.364874170138889e+05
``````

There is one answer in question pgfplots data time format, but I'm not sure how to apply it to this situation.

• `pgfplots` can't handle seconds in datetimes, so I'd suggest making a vector of decimal seconds (`t2 = datevec(time-time(1));t2=t2(:,6);`) and having seconds on the x-axis. Describe in the caption that it is seconds starting at HH:MM:SS.SSS on dd.mm.yyyy. – Torbjørn T. Aug 24 '16 at 21:25
• Has the comment of TorbjørnT. helped you to find a suitable solution? – Stefan Pinnow Oct 9 '16 at 14:02
• @StefanPinnow it was not exactly what I was looking for but maybe there is no way to achive what I wanted – Lesenger Oct 9 '16 at 15:53

This might well be possible with `pgfplots`, but it's likely easier to make a new time vector in Matlab that contains the number of seconds from time zero. E.g. in Matlab do `t2 = datevec(time-time(1));t2=t2(:,6);`, where `time` is the name of your original time vector. Then you can describe in the caption and/or xlabel that the x-coordinate is seconds after HH:MM:SS.SS.