当我试图用Python加载.mat文件时,我面临以下错误:
error Traceback (most recent call last)
<ipython-input-4-c3171c29e3cc> in <module>()
1 if __name__ == '__main__':
2 print('Inside Main')
----> 3 mat = loadmat("/content/01_01_c0001_info.mat")
4 print("File Read........")
2 frames
/usr/local/lib/python3.7/dist-packages/scipy/io/matlab/mio5.py in read_var_header(self)
224 self._matrix_reader.set_stream(stream)
225 check_stream_limit = self.verify_compressed_data_integrity
--> 226 mdtype, byte_count = self._matrix_reader.read_full_tag()
227 else:
228 check_stream_limit = False
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.read_full_tag()
mio5_utils.pyx in scipy.io.matlab.mio5_utils.VarReader5.cread_full_tag()
streams.pyx in scipy.io.matlab.streams.ZlibInputStream.read_into()
streams.pyx in scipy.io.matlab.streams.ZlibInputStream._fill_buffer()
error: Error -3 while decompressing data: invalid distance too far back
正如我们所看到的,loadmat函数中出现了错误。
代码示例如下:
import numpy as np
from scipy.io import loadmat
if __name__ == '__main__':
print('Inside Main')
mat = loadmat("/content/01_01_c0001_info.mat")
print("File Read........")
文件已损坏。再次下载。现在已经修复。谢谢