[英]In matlab, how to read python pickle file?
In python, I generated a .p data file by 在python中,我生成了一个.p数据文件
pickle.dump( allData, open( "myallData.p", "wb" ))
Now I want to read myallData.p in Matlab. 现在我想在Matlab中阅读myallData.p。 (My Matlab is installed under Windows 8, which does not have python in it.) Any ideas?
(我的Matlab安装在Windows 8下,其中没有python。)有什么想法吗? Thanks in advance.
提前致谢。
I ended up with read the data back from the .p file: 我最终从.p文件中读取了数据:
[whatever_data]=pickle.load( open( "myallData.p", "rb" ) )
Then use scipy to convert and save the data to .mat 然后使用scipy将数据转换并保存到.mat
import numpy, scipy.io
scipy.io.savemat('/home/myfiles/mydata.mat', mdict={'whatever_data': whatever_data})
So as to avoid dealing with pickle. 这样可以避免处理泡菜。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.