Skip to Main Content Skip to Search
Product Documentation

h5read - Read data from HDF5 data set

Syntax

data = h5read(filename,datasetname)
data = h5read(filename,datasetname,start,count)
data = h5read(filename,datasetname,start,count,stride)

Description

data = h5read(filename,datasetname) retrieves all of the data from the HDF5 data set datasetname in the file filename.

data = h5read(filename,datasetname,start,count) reads a subset of data from the data set datasetname. start is the one-based index of the first element to be read. count defines how many elements to read along each dimension. If a particular element of count is Inf, h5read reads data until the end of the corresponding dimension.

data = h5read(filename,datasetname,start,count,stride) reads a subset of data, where stride specifies the interelement spacing along each data set extent.

Input Arguments

filename

Text string specifying the name of an HDF5 file.

datasetname

Text string specifying the name of a data set in an HDF5 file.

start

Numeric index value specifying the place to start reading data in the dataset in an HDF5 file. Indices are 1-based.

count

Numeric value specifying the amount of data to read.

stride

Numeric value specifying the intervalue spacing during the read operation. For example, a spacing of 2 indicates reading every other value.

Output Arguments

data

Data read from the data set.

Examples

Read an entire data set.

h5disp('example.h5','/g4/lat');
data = h5read('example.h5','/g4/lat');
 

Read the first 5-by-3 subset of a data set.

h5disp('example.h5','/g4/world');
data = h5read('example.h5','/g4/world',[1 1],[5 3]);
 

Read a data set of references to other data sets.

h5disp('example.h5','/g3/reference');
data = h5read('example.h5','/g3/reference');

See Also

h5disp | h5readatt | h5write | h5writeatt

Tutorials

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS