Datetime, parsing problem

7 Ansichten (letzte 30 Tage)
mehra
mehra am 7 Jun. 2019
Beantwortet: mehra am 10 Jun. 2019
I am using Datetime function for a set of 104 excel data, but in some of the data I face with parsing error, although all the files have the same format and the excel cell that will be used in the datetime also is the same in all the data sets but datetime give error that it can not parse the
why this happens and how I can Solve it?
  6 Kommentare
Walter Roberson
Walter Roberson am 10 Jun. 2019
In datatime parsing, you cannot use SS to indicate that you want 12 digits of fractions of a second. You would need to use 12 S's to indicate 12 digits of fractions of a second. However, MATLAB only permits 9 S's, so your 09:55:46.663917949583 cannot be processed. MATLAB cannot store seconds that precise. You will need to process the times to reduce it to 9 digits.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Jun. 2019
Bearbeitet: Walter Roberson am 10 Jun. 2019
dummy3 = regexprep(dummy2, '\.(\d{9})\d{3} ', '.$1 '); %remove last 3 digits
recdate = datetime(dummy3, 'InputFormat', 'HH:mm:ss.SSSSSSSSS dd.MM.yyyy');

Weitere Antworten (2)

mehra
mehra am 10 Jun. 2019
Thank you very much, but here some of my fıles can be processed however in all of them there are 12 digits for seconds

mehra
mehra am 10 Jun. 2019
Thank you very much

Kategorien

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by