Main Content

matlab.io.fits.readRecord

Read header record specified by number

Syntax

card = matlab.io.fits.readRecord(fptr,recnum)

Description

card = matlab.io.fits.readRecord(fptr,recnum) returns an entire 80-character header record, with any trailing blank characters removed. Specify recnum as a positive integer. The function returns card as a character vector.

Examples

collapse all

Read the records in a sample FITS file.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
[nrecs,~] = fits.getHdrSpace(fptr);
for j = 1:nrecs
    card = fits.readRecord(fptr,j);
    fprintf('Record %d: "%s"\n',j,card)
end
Record 1: "SIMPLE  =                    T / Standard FITS file"
Record 2: "BITPIX  =                  -32 / No. of bits per pixel"
Record 3: "NAXIS   =                    2 / No. of axes in matrix"
Record 4: "NAXIS1  =                  102 / No. of pixels in X"
Record 5: "NAXIS2  =                  109 / No. of pixels in Y"
Record 6: "EXTEND  =                    T / There may be FITS extensions"
Record 7: "BLOCKED =                    T / The file may be blocked"
Record 8: ""
Record 9: "CDELT1  =                  3.1 / Coordinate increment"
Record 10: "CRVAL1  =               1299.1 / Coordinate of reference pixel"
Record 11: "CRPIX1  =                 12.3 / Reference pixel in X"
Record 12: ""
Record 13: "CDELT2  =                -0.17 / Coordinate increment"
Record 14: "CRVAL2  =               -102.4 / Coordinate of reference pixel"
Record 15: "CRPIX2  =              -2031.8 / Reference pixel in Y"
Record 16: ""
Record 17: "OBJECT  = 'Wave 32-bit FP'     / Name of image"
Record 18: "ORIGIN  = 'ESO     '           / File was prepared at ESO-Garching"
Record 19: "DATE    = '20/08/92'           / Creation data of this file"
Record 20: ""
Record 21: "COMMENT  This test file was created by P.Grosbol, ESO (pgrosbol@eso.org)"
Record 22: ""
Record 23: "COMMENT  Simple 32-bit FP sine wave pattern for testing of FITS readers"
fits.closeFile(fptr)

Tips

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