Main Content

matlab.io.fits.getHDUtype

Get type of current HDU in FITS file

Syntax

htype = matlab.io.fits.getHDUtype(fptr)

Description

htype = matlab.io.fits.getHDUtype(fptr) returns the type of the current HDU in the FITS file. The function returns htype as 'IMAGE_HDU', 'ASCII_TBL', or 'BINARY_TBL'.

Examples

collapse all

Get the types of all the HDUs in a sample file.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
N = fits.getNumHDUs(fptr);
for j = 1:N
    fits.movAbsHDU(fptr,j);
    htype = fits.getHDUtype(fptr);
    fprintf(['HDU #' num2str(j) ' is of type ' htype '.\n'])
end
HDU #1 is of type IMAGE_HDU.
HDU #2 is of type BINARY_TBL.
HDU #3 is of type IMAGE_HDU.
HDU #4 is of type IMAGE_HDU.
HDU #5 is of type ASCII_TBL.
fits.closeFile(fptr)

Tips

  • This function corresponds to the fits_get_hdu_type (ffghdt) 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