Documentation Center

  • Trial Software
  • Product Updates

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

See Also

|

Was this topic helpful?