Main Content

matlab.io.fits.getHdrSpace

Get number of keywords in header

Syntax

[nkeys,morekeys] = fits.getHdrSpace(fptr)

Description

[nkeys,morekeys] = fits.getHdrSpace(fptr) returns the number of existing keywords (not counting the END keyword) and the amount of space currently available for more keywords. It returns morekeys = -1 if the header has not yet been closed. Note that the CFITSIO library will dynamically add space if required when writing new keywords to a header so in practice there is no limit to the number of keywords that can be added to a header.

This function corresponds to the fits_get_hdrspace (ffghsp) function in the CFITSIO library C API.

Examples

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
[nkeys,morekeys] = fits.getHdrSpace(fptr);
fits.closeFile(fptr);