Main Content

matlab.io.fits.readKey

Keyword

Syntax

[value,comment] = readKey(fptr,keyname)

Description

[value,comment] = readKey(fptr,keyname) returns the specified key and comment. Specify keyname as a character vector or string scalar. value and comment are returned as character vectors.

This function corresponds to the fits_read_key_str (ffgkys) function in the CFITSIO library C API.

Examples

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
n = fits.getNumHDUs(fptr);
for j = 1:n
    fits.movAbsHDU(fptr,j);
    [key,comment] = fits.readKey(fptr,'NAXIS');
    fprintf('HDU %d:  NAXIS %s, "%s"\n', j, key, comment);
end
fits.closeFile(fptr);