scipy.io.matlab.miobase.MatWriteError: Matrix too large to save with Matlab 5 format

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

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值