Main Content

matlab.io.fits.readCard

Read header record of keyword

Syntax

card = matlab.io.fits.readCard(fptr,keyname)

Description

card = matlab.io.fits.readCard(fptr,keyname) returns the entire 80-character header record of a keyword, with any trailing blank characters removed. Specify keyname as a string scalar or character vector. The function returns card as a character vector.

Examples

collapse all

Read the headers for the keyword NAXIS for all the HDUs in a sample FITS file.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
N = fits.getNumHDUs(fptr);
for j = 1:N
    fits.movAbsHDU(fptr,j);
    card = fits.readCard(fptr,"NAXIS");
    fprintf('HDU %d: "%s"\n',j,card)
end
HDU 1: "NAXIS   =                    2 / No. of axes in matrix"
HDU 2: "NAXIS   =                    2 / Binary tables have 2 axes"
HDU 3: "NAXIS   =                   13 / A total of 13 axes !!!"
HDU 4: "NAXIS   =                    3 / Three axes"
HDU 5: "NAXIS   =                    2 / ASCII tables has 2 axes"
fits.closeFile(fptr)

Tips

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