【发布时间】:2015-02-01 02:04:17
【问题描述】:
我在 Matlab 中将元胞数组保存为 .mat 文件,如下所示:
test = {'hello'; 'world!'};
save('data.mat', 'test', '-v7.3')
如何使用 H5py 将其作为 Python 中的字符串列表导入?
我试过了
f = h5py.File('data.mat', 'r')
print f.get('test')
print f.get('test')[0]
打印出来:
<HDF5 dataset "test": shape (1, 2), type "|O8">
[<HDF5 object reference> <HDF5 object reference>]
如何取消引用它以在 Python 中获取字符串列表 ['hello', 'world!']?
【问题讨论】: