Matlab: Read Hdf5 files
Posted by rolf on Friday, 13 March 2015
If you need to read in a hdf5 file (.h5) in matlab, use the function h5read.
The syntax is
data = h5read(filename,datasetname);
The "filename" is obvious, e.g. /the/path/to/the/file/name.h5
. The "datasetname" can be found by using the tool hdfview or by using the linux terminal tool h5ls
installation:
sudo apt-get install hdf5-tools
usage:
h5ls name_of_h5_file.h5
gives you an output like
DISPARITY Dataset {7, 7, 375, 375}
coherence_h Dataset {7, 7, 375, 375}
coherence_v Dataset {7, 7, 375, 375}
disparity_h Dataset {7, 7, 375, 375}
disparity_v Dataset {7, 7, 375, 375}
the names in the first column are the datasetname, so e.g.
data = h5read('name_of_h5_file.h5', 'coherence_v');
Add new comment