Main Content

matlab.io.fits.getNumHDUs

Get number of HDUs in FITS file

Syntax

N = matlab.io.fits.getNumHDUs(fptr)

Description

N = matlab.io.fits.getNumHDUs(fptr) returns the number of completely defined HDUs in a FITS file. If a new HDU has just been added to the file, then that HDU is counted only if it has been closed or if data has been written to it. This function does not change the current HDU.

Examples

collapse all

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
N = fits.getNumHDUs(fptr)
N = 
5
fits.closeFile(fptr)

Tips

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

  • To use this function, you must be familiar with the CFITSIO C interface. You can access the CFITSIO documentation at the CFITSIO website.

Extended Capabilities

expand all

Version History

expand all