Main Content

File (H5F)

HDF5 file access

Description

Use the MATLAB® HDF5 file interface, H5F, to create, open, and close HDF5 files, and access information about them.

Functions

H5F.close

Close HDF5 file

H5F.close(fileID) terminates access to the HDF5 file identified by fileID and flushes all data to storage.

H5F.create

Create HDF5 file

fileID = H5F.create(filename) creates the file specified by specified by filename or by a uniform resource locator (URL) with the default library properties if the file does not already exist.

fileID = H5F.create(filename,flags,fcplID,faplID) creates the file specified by filename or by a URL with additional parameters.

 Details

H5F.flush

Flush all data buffers to disk

H5F.flush(objID,scope) causes all buffers associated with a file to be immediately flushed to disk without removing the data from the cache.

 Details

H5F.get_access_plist

File access property list

faplID = H5F.get_access_plist(fileID) returns the file access property list identifier of the file specified by fileID.

H5F.get_create_plist

File creation property list

fcplID = H5F.get_create_plist(fileID) returns a file creation property list identifier identifying the creation properties used to create the file specified by fileID.

H5F.get_filesize

Size of HDF5 file

size = H5F.get_filesize(fileID) returns the size of the HDF5 file specified by fileID.

H5F.get_freespace

Amount of free space in file

freespace = H5F.get_freespace(fileID) returns the amount of space that is unused by any object in the file specified by fileID.

H5F.get_info

Global information about file

info = H5F.get_info(objID) returns global information for the file associated with the object identifier objID. For details about the fields of the info structure, please refer to the HDF5 documentation.

H5F.get_intent

Intended access mode of the HDF5 file

intent = H5F.get_intent(fileID) returns the intended access mode flag passed in with H5F.open when the file was opened.

 Details

H5F.get_mdc_config

Metadata cache configuration

config = H5F.get_mdc_config(fileID) returns the current metadata cache configuration for the target file.

H5F.get_mdc_hit_rate

Metadata cache hit-rate

hitRate = H5F.get_mdc_hit_rate(fileID) queries the metadata cache of the target file to obtain its hit-rate since the last time hit-rate statistics were reset. If the cache has not been accessed since the last time the hit-rate statistics were reset, the hit-rate is defined to be 0.0.

The hit-rate is calculated as the number of cache hits divided by the sum of cache hits and cache misses.

H5F.get_mdc_size

Metadata cache size data

[maxsize,minsize,currentSize,entries] = H5F.get_mdc_size(fileID) queries the metadata cache of the target file to obtain current metadata cache size information.

 Details

H5F.get_metadata_read_retry_info

List of read retries for metadata entries

retryInfo = H5F.get_metadata_read_retry_info(fileID) returns a cell array of numeric vectors containing information regarding the number of read retries for metadata entries with checksum for the file fileID.

H5F.get_name

Name of HDF5 file

name = H5F.get_name(objID) returns the name of the file to which the object specified by objID belongs. The object can be a group, dataset, attribute, or named data type.

H5F.get_obj_count

Number of open objects in HDF5 file

objcount = H5F.get_obj_count(fileID,types) returns the number of open object identifiers in fileID that are of type types.

 Details

H5F.get_obj_ids

List of open HDF5 file objects

[numobjIDs,objIDList] = H5F.get_obj_ids(fileID,types,maxObjs) returns a list of all open object identifiers in fileID that are of type specified by types.

 Details

H5F.is_hdf5

Determine if file is HDF5

output = H5F.is_hdf5(filename) returns a positive value if the file specified by filename is in the HDF5 format, and 0 if it is not. A negative return value indicates a failure (including the case where filename does not exist).

 Details

H5F.mount

Mount HDF5 file onto specified location

H5F.mount(locID,name,childID,plistID) mounts the file specified by childID onto the group specified by locID and name using the mount properties specified by plistID.

 Details

H5F.open

Open HDF5 file

fileID = H5F.open(filename) opens the file specified by filename or a uniform resource locator (URL) for read-only access.

fileID = H5F.open(filename,flags,faplID) opens the file specified by filename or a uniform resource locator (URL), and using the file access mode specified by flags and the file access property list identifier faplID.

 Details

H5F.reopen

Reopen HDF5 file

newfileID = H5F.reopen(fileID) returns a new file identifier for the open HDF5 file specified by fileID.

H5F.set_mdc_config

Configure HDF5 file metadata cache

H5F.set_mdc_config(fileID,config) attempts to configure the metadata cache of the file according to the configuration structure, config. Before using this function, you should retrieve the current configuration using H5F.get_mdc_config.

H5F.start_swmr_write

Enable Single-Writer/Multiple-Reader writing mode

H5F.start_swmr_write(fileID) activates the Single-Writer/Multiple-Reader (SWMR) writing mode for the file specified by fileID.

 Details

H5F.unmount

Unmount file or group from mount point

H5F.unmount(locID,name) disassociates the file or group specified by locID from the mount point specified by name. locID can be a file or group identifier.

Examples

expand all

fid = H5F.create("myfile.h5");
H5F.close(fid);
fid = H5F.open("example.h5");
H5F.close(fid);

Version History

Introduced before R2006a

expand all