Converting Matlab's datenum format to Python

后端 未结 5 1743
甜味超标
甜味超标 2020-12-01 12:59

I just started moving from Matlab to Python 2.7 and I have some trouble reading my .mat-files. Time information is stored in Matlab\'s datenum format. For those who are not

5条回答
  •  眼角桃花
    2020-12-01 13:41

    You link to the solution, it has a small issue. It is this:

    python_datetime = datetime.fromordinal(int(matlab_datenum)) + timedelta(days=matlab_datenum%1) - timedelta(days = 366)
    

    a longer explanation can be found here

提交回复
热议问题