2016-12-30 41 views

回答

0

你可以做这样的事情:

import matplotlib.pyplot as plt 
import h5py 

# open the file 
with h5py.File("yourFile.h5") as dataH5: 
    # get the keys 
    key_list = dataH5.keys() 
    for key in key_list: 
    # show every matrix for a given key 
    matrix = dataH5.get(key) 
    plt.imshow(matrix.reshape(matrix.shape[0], matrix.shape[1]), cmap=plt.cm.Greys) 
    plt.show() 

我想你知道如何HDF5文件组织。所以密钥可以访问数据。 您可以使用matplotlib打印这些数据。

+0

感谢您的回复。 –

+0

'灰'的含义是什么? –

+0

这是一个错误。我编辑上面的代码。 –