簡體   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