Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python h5py:切片h5py数据集时出错_Python_Matlab_Numpy_H5py - Fatal编程技术网

Python h5py:切片h5py数据集时出错

Python h5py:切片h5py数据集时出错,python,matlab,numpy,h5py,Python,Matlab,Numpy,H5py,[更新:问题已经解决。请参阅解决方案的结尾] 我试图分割一个h5py数据集,但在这里只得到一个错误 In[76]: dataset['traindata'] Out[76]: <HDF5 dataset "traindata": shape (100, 50), type "<f4"> In[76]: dataset['traindata'][0, 0:10] ----------------------------------------------------------

[更新:问题已经解决。请参阅解决方案的结尾]

我试图分割一个h5py数据集,但在这里只得到一个错误

In[76]: dataset['traindata']
Out[76]: <HDF5 dataset "traindata": shape (100, 50), type "<f4">

In[76]: dataset['traindata'][0, 0:10]
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
<ipython-input-77-4033a3d41a81> in <module>()
----> 1 dataset['traindata'][0, 0:10]

E:\Anaconda\lib\site-packages\h5py\_hl\dataset.pyc in __getitem__(self, args)
    437         mspace = h5s.create_simple(mshape)
    438         fspace = selection._id
--> 439         self.id.read(mspace, fspace, arr, mtype)
    440 
    441         # Patch up the output for NumPy

SystemError: error return without exception set
[76]中的
:数据集['traindata']
出[76]:
[76]中:数据集['traindata'][0,0:10]
---------------------------------------------------------------------------
系统错误回溯(最近一次调用上次)
在()
---->1数据集['traindata'][0,0:10]
E:\Anaconda\lib\site packages\h5py\\u hl\dataset.pyc在\uuuuuu getitem\uuuuuuuu中(self,args)
437 mspace=h5s。创建简单(mshape)
438 fspace=选择。\u id
-->439 self.id.read(mspace、fspace、arr、mtype)
440
441#修补NumPy的输出
SystemError:返回错误,未设置异常
但当我在同一组中切片另一个数据集时,它似乎工作得很好

In[74]: dataset['trainlabel']
Out[74]: <HDF5 dataset "trainlabel": shape (1, 50), type "<i4">

In[75]: dataset['trainlabel'][0, 0:10]
Out[75]: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
[74]中的
:数据集['trainlabel']
出[74]:
在[75]中:数据集['trainlabel'][0,0:10]
Out[75]:数组([0,0,0,0,0,0,0,0,0])
我不太明白
dataset['trainlabel']
有什么问题

以前有人碰到过这个吗?谢谢

另外,数据集是从v7.3.mat文件中读取的。“traindata”最初是一个单精度矩阵,“trainlabel”是.mat文件中的int32向量


[解决方案:使用从提供的预构建版本覆盖现有h5py库(随Anaconda提供)

你给Matlab贴了什么标签?@Dan数据是从v7.3 Matlab文件中读取的,所以我想一些Matlab的家伙可能有一个想法…你从数据集['traindata']中得到了什么。值?你能切分吗?@askewchan只会得到相同的错误…你应该添加你的解决方案作为答案,然后在48小时的冷却期后接受它,这样它就不会被列为
未回答的