Skip to content

Instantly share code, notes, and snippets.

@jaeoh2
Created December 7, 2016 15:29
Show Gist options
  • Save jaeoh2/623404a66971d390d78e270056cccd11 to your computer and use it in GitHub Desktop.
Save jaeoh2/623404a66971d390d78e270056cccd11 to your computer and use it in GitHub Desktop.
read .mat(hdf5) file to python
import h5py
import numpy as np
with h5py.File('mydatafile.mat','r') as hf:
print('List of arrays in this file:{}'.format(hf.keys()))
data = hf.get('dataset_1')
np_data = np.array(data)
print('Shape of the array dataset_1:{}.format(np_data.shape))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment