I'm trying to read a mat file using python's scipy io library, specifically a struct that contains an array of datetimes but it's not getting the information from the array. How do I extract the information?(An example of a cell: 22-Jul-2017)
import scipy.io as sio
# create string value to mat file
matPath = 'data/2017_Pervious11_F5.mat'
# load the information in the file in a format that python can interpret
matfile = sio.loadmat(matPath)
# in order: for slab1 get date_time, rn, qh,qe,qg and sup
s1_dates = matfile['S1']['D']
Output:
s1_dates [ MatlabOpaque([ (b'', b'MCOS', b'datetime', array([[3707764736],[ 2], [ 1], [ 1], [ 12],[ 2]], dtype=uint32))], dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')])]
MatlabOpaque, it looks like thematfile contains some MATLAB class/object thatloadmatcannot translate intonumpy. Dates, unless given in some consistent string format, are not readily interchangeable across programming languages. I wouldn't expect a Pythondatetimeobject to be usable in MATLAB.