python 读写Matlab mat v7.3文件
Introduction — hdf5storage 0.1.14 documentation
问题:
一开始想使用scipy.io保存.mat文件(sio.savemat()),但是疯狂报错MatWriteError: Matrix too large to save with Matlab 5 format
解决方案:
使用hdf5storage.savemat()即可
具体方法:
pip install hdf5storage
# layer_data = {'keys': item, 'values': feature_all[item]}
# sio.savemat(save_name, layer_data)
keys = list(feature_all.keys())
values = list(feature_all[item])
layer_data = {'keys': item, 'values': values}
# hdf5storage.savemat(save_name, layer_data ,do_compression=True, format='7.3')
hdf5storage.savemat(save_name, layer_data, format='7.3', matlab_compatible = True)
# 读出mat文件
matcontent = hdf5storage.loadmat('X.mat')
InputImage1 = matcontent['XX']

最低0.47元/天 解锁文章
4047

被折叠的 条评论
为什么被折叠?



