Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

H5F.open

Open HDF5 file

Syntax

file_id = H5F.open(filename)
file_id = H5F.open(name,flags,fapl_id)

Description

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

file_id = H5F.open(name,flags,fapl_id) opens the file specified by name, returning the file identifier, file_id. flags specifies file access flags and can be specified by one of the following character vectors 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.

Examples

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

fid = H5F.open('example.h5');
H5F.close(fid); 

Open a file in read-write mode.

srcFile = fullfile(matlabroot,'toolbox','matlab','demos','example.h5');
copyfile(srcFile,'myfile.h5');
fileattrib('myfile.h5','+w');
fid = H5F.open('myfile.h5','H5F_ACC_RDWR','H5P_DEFAULT');
H5F.close(fid);
Was this topic helpful?