繁体   English   中英

python读取mat文件日期时间数组

[英]python read mat file datetime array

我正在尝试使用python的scipy io库读取一个mat文件,特别是一个包含日期时间数组但不从该数组获取信息的结构。 我该如何提取信息?(一个单元格的示例:2017年7月22日)

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']

输出:

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')])]

对我有用的一种解决方案是将所有矩阵条目转换为'char'格式(在MATLAB中),然后使用'scipy.io.loadmat'加载新的.mat文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM