datestring shows incorrect answers

2 visualizzazioni (ultimi 30 giorni)
navan
navan il 1 Giu 2016
Modificato: navan il 2 Giu 2016
I have taken a specific date from Igor pro and import it into matlab. the corresponding integer value of the time '1/1/2016 00:00:00.058 'when i upload the file from igor pro into matlab was '3534468465.15625'. When i try to use the date string function
t=3534468465.15625;
string=datestr(t);
the output is coming as '22-Dec-7045 03:45:00'. But the required answer was '1/1/2016 00:00:00.058'. Can some one please help why this error is happening ?

Risposta accettata

Thorsten
Thorsten il 2 Giu 2016
Modificato: Thorsten il 2 Giu 2016
Igor Pro uses the seconds since 1904-01-01. So you can convert it using
dv = datevec(3534468465.15625/(3600*24) + datenum(1904, 1, 1, 0, 0, 0))
Which gives ans =
2016.00 1.00 1.00 4.00 47.00 45.16
This gives the correct year, month and day, but the time is still wrong.
Are you 100% sure that the correct time is '1/1/2016 00:00:00.058 ' and not '1/1/2016 04:47:45.16'?
  1 Commento
navan
navan il 2 Giu 2016
Modificato: navan il 2 Giu 2016
Dear Thorsten, Thanks a lot for that great help. You are exactly right. Mine output was wrong. The Answer you were getting was the right one and the required answer. thanks again for your valuable time and helping me :)

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Time Series Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by