Main Content

matlab.io.fits.getNumHDUs

Total number of HDUs in FITS file

Syntax

N = getNumHDUs(fptr)

Description

N = getNumHDUs(fptr) returns the number of completely defined HDUs in a FITS file. If a new HDU has just been added to the FITS file, then that last HDU will only be counted if it has been closed, or if data has been written to the HDU. The current HDU remains unchanged by this routine.

This function corresponds to the fits_get_num_hdus (ffthdu) function in the CFITSIO library C API.

Examples

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
n = fits.getNumHDUs(fptr);
fits.closeFile(fptr);

See Also