H5F.create

Create HDF5 file

Syntax

file_id = H5F.create(filename)
file_id = H5F.create(name,flags,fcpl_id,fapl_id)
file_id = H5F.create(URL)
file_id = H5F.create(URL,flags,fcpl_id,fapl_id)

Description

file_id = H5F.create(filename) creates the file specified by filename with default library properties if the file does not already exist.

file_id = H5F.create(name,flags,fcpl_id,fapl_id) creates the file specified by name. flags specifies whether to truncate the file, if it already exists, or to fail if the file already exists. flags can be specified by one of the following character vectors or string scalars, or their numeric equivalent:

'H5F_ACC_TRUNC'overwrite any existing file by the same name
'H5F_ACC_EXCL'do not overwrite an existing file

fcpl_id is the file creation property list identifier. fapl_id is the file access property list identifier. A value of 'H5P_DEFAULT' for either property list indicates that the library should use default values for the appropriate property list.

file_id = H5F.create(URL) creates the HDF5 file at the remote location specified by a uniform resource locator (URL) with default library properties if the file does not already exist.

For more information, see Work with Remote Data.

file_id = H5F.create(URL,flags,fcpl_id,fapl_id) creates the file at the remote location specified by a URL. flags specifies whether to truncate the file, if it already exists, or to fail if the file already exists. fcpl_id is the file creation property list identifier. fapl_id is the file access property list identifier.

Examples

Create an HDF5 file called 'myfile.h5'.

fid = H5F.create('myfile.h5');
H5F.close(fid);

Create an HDF5 file called 'myfile.h5', overwriting any existing file by the same name. Default file access and file creation properties shall apply.

fcpl = H5P.create('H5P_FILE_CREATE');
fapl = H5P.create('H5P_FILE_ACCESS');
fid = H5F.create('myfile.h5','H5F_ACC_TRUNC',fcpl,fapl);
H5F.close(fid);

Create an HDF5 file called 'myfile.h5' in Amazon S3™.

fid = H5F.create('s3://bucketname/path_to_file/myfile.h5');
H5F.close(fid);

Limitations

  • H5F.create does not support creating files stored remotely in HDFS™.