How to read time of (YY:DOY:SSSSS) format ?

6 views (last 30 days)
Ebtesam Farid
Ebtesam Farid on 4 Jul 2021
Commented: Peter Perkins on 27 Jul 2021
Hello guys,
I have a text file contains GNSS processed meansurements with time resolution (5-min) [every 300 sec), the date fromat are (YY:DOY:SSSSS) format, and its type is string in the file, I tired to read it with readtable but I got error message
T = readtable(filename, 'Format','%{yy:dayofyear:sssss}D %f');
the error message is:
Unable to read the DATETIME data with the format 'yy:dayofyear:sssss'. If the data is not a time
I attached the file ( the file conatins 5 rows as a header)
any suggestion on how to read a date in this format??

Accepted Answer

Yazan on 4 Jul 2021
Try this:
readtable(filename, 'Format', '%{uu:DDD:SSSS}D %f')
Peter Perkins
Peter Perkins on 27 Jul 2021
readtable(filename, 'Format', '%{uu:DDD:SSSS}D %f')
can't possibly be right. S is fractional seconds. It's parsing those timestamps completely wrong. Maybe if you do something like this
>> d = datetime('2021:135:12345',"InputFormat","uuuu:DDD:SSSSS","Format","uuuu:DD HH:mm:ss.SSSSSSSSS")
d =
2021:135 00:00:00.123450000
>> s = d.Second
s =
>> d = dateshift(d,'start','day') + seconds(1e5*s)
d =
2021:135 03:25:45.000000000
>> second(d,"secondofday")
ans =
but there is no datetime format that will parse or display "second of day". And then this
isn't going to be right, again you'd need second(d,"secondofday").

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!