This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Open HDF5 file


file_id =
file_id =,flags,fapl_id)


file_id = opens the file specified by filename for read-only access and returns the file identifier, file_id.

file_id =,flags,fapl_id) opens the file specified by name, returning the file identifier, file_id. Specify the file access flags flags as one of the these character vectors or string scalars, or their numeric equivalents:

'H5F_ACC_RDWR'read-write mode
'H5F_ACC_RDONLY'read-only mode

The file access property list, fapl_id, may be specified as 'H5P_DEFAULT', in which case the default I/O settings are used.


Open a file in read-only mode with default file access properties.

fid ='example.h5');

Open a file in read-write mode.

srcFile = fullfile(matlabroot,'toolbox','matlab','demos','example.h5');
fid ='myfile.h5','H5F_ACC_RDWR','H5P_DEFAULT');