Main Content


Gateway to HDF H interface


[out1,...,outN] = hdfh(funcstr,input1,...,inputN)


hdfh is the MATLAB® gateway to the HDF H interface.

[out1,...,outN] = hdfh(funcstr,input1,...,inputN) returns one or more outputs corresponding to the H function in the HDF library specified by functstr.

There is a one-to-one correspondence between H functions in the HDF library and valid values for funcstr. For example, hdfh('close',file_id) corresponds to the C library call Hclose(file_id).


Value of funcstrFunction SyntaxDescription

status = hdfh('appendable',access_id)

Specifies that the element can be appended to.

status = hdfh('close',file_id)

Closes the access path to the file.

status = hdfh('deldd',file_id,tag,ref)

Deletes a tag and reference number from the data descriptor list.

status = hdfh('dupdd',file_id,tag,ref,old_tag,old_ref)


status = hdfh('endaccess',access_id)

Terminates access to a data object by disposing of the access identifier.

[filename,access_mode,attach,status] = hdfh('fidinquire',file_id)

Returns information about specified file.

[tag,ref,offset,length,status] = hdfh('find',file_id,... search_tag,search_ref,search_type,dir)

Locates the next object to be searched for in an HDF file. search_type can be 'new' or 'continue'. The dir input can be 'forward' or 'backward'.

[data,status] = hdfh('getelement',file_id,tag,ref)

Reads the data element for the specified tag and reference number.

[major,minor,release,info,status] = hdfh('getfileversion',file_id)

Returns version information for an HDF file.

[major,minor,release,info,status] = hdfh('getlibversion')

Returns version information for the current HDF library.

special,status] = hdfh('inquire',access_id)

Returns access information about a data element.

tf = hdfh('ishdf',filename)

Determines if a file is an HDF file.

length = hdfh('length',file_id,tag,ref)

Returns the length of a data object specified by the tag and reference number.

ref = hdfh('newref',file_id)

Returns a reference number that can be used with any tag to product a unique tag/reference number pair.

status = hdfh('nextread',access_id,tag,ref,origin)

Searches for the next data descriptor that matches the specified tag and reference number. origin can be 'start' or 'current'.

num = hdfh('number',file_id,tag)

Returns the number of instances of a tag in a file.

offset = hdfh('offset',file_id,tag,ref)

Returns the offset of a data element in the file.

file_id = hdfh('open',filename,access,n_dds)

Provides an access path to an HDF file by reading all the data descriptor blocks into memory.

count = hdfh('putelement',file_id,tag,ref,X)

Writes a data element or replaces an existing data element in an HDF file. X must be a uint8 array.

X = hdfh('read',access_id,length)

Reads the next segment in a data element.

status = hdfh('seek',access_id,offset,origin)

Sets the access pointer to an offset within a data element. origin can be 'start' or 'current'.

access_id = hdfh('startread',file_id,tag,ref)


access_id = hdfh('startwrite',file_id,tag,ref,length)


status = hdfh('sync',file_id)


length = hdfh('trunc',access_id,trunc_len)

Truncates the specified data object to the given length.

count = hdfh('write',access_id,X)

Writes the next data segment to a specified data element. X must be a uint8 array.

Output Arguments

A status or identifier output of -1 indicates that the operation failed.


  • hdfh does not support these functions in the NCSA H interface:

    • Hcache

    • Hendbitaccess

    • Hexist

    • Hflushdd

    • Hgetbit

    • Hputbit

    • Hsetlength

    • Hshutdown

    • Htagnewref

Version History

Introduced before R2006a