Main Content

matlab.io.fits.movNamHDU

Move to first HDU having specific type and keyword values

Syntax

matlab.io.fits.movNamHDU(fptr,hdutype,extname,extver)

Description

matlab.io.fits.movNamHDU(fptr,hdutype,extname,extver) moves to the first HDU that has the specified extension type and whose EXTNAME and EXTVER keywords (or HDUNAME and HDUVER keywords) have the values specified by extname and extver, respectively.

Specify the hdutype argument as one of these values:

  • "IMAGE_HDU"

  • "ASCII_TBL"

  • "BINARY_TBL"

  • "ANY_HDU"

If you specify hdutype as "ANY_HDU", then the function uses only the extname and extver values to locate the extension. If you specify extver as 0, then the function ignores the extver argument and moves to the first HDU with a matching EXTNAME (or HDUNAME) key value.

Examples

collapse all

In a sample FITS file, move to the first image HDU that has the specified EXTNAME and EXTVER keyword values.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
fits.movNamHDU(fptr,"IMAGE_HDU","quality",1)

Confirm the HDU type, extension name, and extension version of the current HDU. Then close the file.

htype = fits.getHDUtype(fptr)
htype = 
'IMAGE_HDU'
[value,comment] = fits.readKey(fptr,"EXTNAME")
value = 
'quality'
comment = 
'Extension name'
[value,comment] = fits.readKey(fptr,"EXTVER")
value = 
'1'
comment = 
'Extension version is 1'
fits.closeFile(fptr)

Tips

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