Convert Python time to Matlab datum
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mark Davidson
am 15 Okt. 2021
Kommentiert: Mark Davidson
am 15 Okt. 2021
How do I convert Python timestamp to a Matlab datenum? I am sure this is a common issue, but I could not find a Matlab function to do this easily.
0 Kommentare
Akzeptierte Antwort
Dave B
am 15 Okt. 2021
Python has several ways it represents time. A common one is so called unix timestamps, which are the number of seconds since 1970:
secssince1970 = 1634287957.292;
datetime(1970,1,1) + seconds(secssince1970)
7 Kommentare
Weitere Antworten (1)
Steven Lord
am 15 Okt. 2021
Don't convert to a datenum. Depending on how the Python timestamp represents the date and time, I suspect some of the values for the ConvertFrom parameter in the datetime function will be of use, something like:
x = 20211015;
dt = datetime(x, 'ConvertFrom', 'yyyymmdd')
1 Kommentar
Siehe auch
Kategorien
Mehr zu Time Series Objects finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!