H5F.open

Open HDF5 file

Syntax

file_id = H5F.open(filename)
file_id = H5F.open(name,flags,fapl_id)
file_id = H5F.open(URL)
file_id = H5F.open(URL,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. 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.

file_id = H5F.open(URL) opens the HDF5 file at a remote location, specified by a uniform resource locator (URL), for read-only access and returns the file identifier file_id.

For more information, see Work with Remote Data.

file_id = H5F.open(URL,flags,fapl_id) opens the file at the remote location specified by a URL, returning the file identifier file_id.

flags specifies file access flags.

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);

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

fid = H5F.open('s3://bucketname/path_to_file/example.h5');
H5F.close(fid); 

Limitations

  • H5F.open does not support reading or writing to files stored remotely in HDFS™ when you specify the file access flag as 'H5F_ACC_RDWR'.