Convert Matlab timestamp to date

I imported a lot of time stamps in Matlab, using this format: yyyy-mm-dd HH:MM:SS.FFF

.

Now I have a vector like this:

>> way(1:70,2)

ans =

   1.0e+05 *

   7.360197487028009
   7.360197487087731
   7.360197487264699
   7.360197487323611
   7.360197487519444
   7.360197487572569
   7.360197487750464
   7.360197487809028
   7.360197487988425
   7.360197488046759
   7.360197488225000
   7.360197488284375
   7.360197488463195
   7.360197488521990
   7.360197488700810
   7.360197488759027
   7.360197488937847
   7.360197488996875
   7.360197489175116
   7.360197489233681
   ...

      

I would like to get a string in this format: yyyy-mm-dd HH:MM:SS

. I tried with this one but doesn't work (I have years since 2013 and more).

Sorry if the question is repeated, but I didn't find an answer on SX or on the web.

Thank.

+3


source to share


1 answer


maybe this?

datestr(way(1:70,2),'yyyy-mm-dd HH:MM:SS')

      

eg. for the first value in the list:



datestr(1e5*7.360197487028009,'yyyy-mm-dd HH:MM:SS')
ans =

2015-02-24 17:58:07

      

NTN

+2


source







All Articles