FUNCTION REFERENCE

h5read

Read data from an HDF5 dataset.

Read data from an HDF5 dataset.

Syntax

data = h5read(filename, ds)

Syntax

data = h5read(filename, ds, start, count)

Syntax

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

ds is the dataset path, such as '/group/data' (the leading / is optional). The size is the reverse of the HDF5 (C-order) dimensions, so a dataset that h5py or h5dump shows as 3x4 reads as 4x3; a one-dimensional dataset reads as a column. Doubles read as double, floats as single, integers as their integer class, HDF5 booleans (h5py bool) as logical and text (variable or fixed length) as a cell array of character vectors. start (one-based), count (Inf: to the end) and stride select a hyperslab, one value per MATLAB dimension. Deflate, shuffle and Fletcher32 filters are read.

Example

m = h5read('data.h5', '/m')

Example

part = h5read('data.h5', '/m', [2 1], [2 Inf])   % rows 2 and 3, every column

Differences from MATLAB: Compound, enum (other than boolean), reference, opaque and array types are not supported; text datasets cannot be read in parts. External filter plugins, external and virtual storage are not used. Reads are limited to 2 GiB. Not in the browser build.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.