Main Content

Error (H5E)

R2026b

Error handling

Description

Use the MATLAB® HDF5 error interface, H5E, to control error handling for HDF5 files.

Functions

H5E.clear

Clear error stack

H5E.clear() clears the error stack for the current thread.

H5E.get_major

Description of major error number

errString = H5E.get_major(majnum) returns a character vector containing the error associated with the major error number, majnum.

The HDF5 group has deprecated the use of this function.

H5E.get_minor

Description of minor error number

errString = H5E.get_minor(minnum) returns a character vector containing the error associated with the minor error number, minnum.

The HDF5 group has deprecated the use of this function.

H5E.walk

Walk error stack

H5E.walk(direction,fnc) walks the error stack for the current thread and calls the specified function for each error along the way. This function corresponds to the H5Ewalk1 function in the HDF5 library C API.

Input Arguments

  • direction — Direction of stack traversal, specified as one of these values or their numeric equivalents:

    • "H5E_WALK_UPWARD" — Begins with the most specific error and ends with the API.

    • "H5E_WALK_DOWNWARD" — Begins with the API and ends with the most specific error.

  • fnc — Callback function handle with this signature: status = fnc(n,error_struct).

    Input Arguments for fnc

    • n — Indexed position of the error in the stack.

    • error_struct — Structure with these fields:

      • maj_num — Major error number.

      • min_num — Minor error number.

      • func_name — Function in which the error occurred.

      • file_name — File in which the error occurred.

      • line — Line in file where the error occurred.

      • desc — Optional supplied description.

    Output Arguments for fnc

    • status — Status indicator, interpreted as follows:

      • non-negative — Success. Continues with the iteration.

      • negative — Failure. Stops the iteration.

Version History

Introduced before R2006a