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.


Create HDF5 file


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


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.


Create an HDF5 file called 'myfile.h5'.

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

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