Reading HDF5 in MATLAB

In Reading a mat file into Python, I learned how to read a mat file for Python programs. What about the reverse? In MATLAB, the relevant functions are hdf5info and hdf5read.

First, we need to save data in Python by using h5py:

import numpy as np
import h5py

f = h5py.File('FileName', 'w')

dataset = f.create_dataset('VariableName', data = numpyArrayContainingData)


You may check the h5py document regarding the method create_dataset.

Then, try the following in MATLAB:

hdf5read('FileName', 'VariableName')

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s