This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Move relative number of HDUs from current HDU


htype = moveRelHDU(fptr,nmove)


htype = moveRelHDU(fptr,nmove) moves a relative number of HDUs forward or backward from the current HDU and returns the HDU type, htype, of the resulting HDU. The possible values for htype are:


This function corresponds to the fits_movrel_hdu (ffmrhd) function in the CFITSIO library C API.


Move through each HDU in succession, then move backwards twice by two HDUs.

fptr = fits.openFile('tst0012.fits');
n = fits.getNumHDUs(fptr);
for j = 1:n
    htype = fits.movAbsHDU(fptr,j);
    fprintf('HDU %d:  "%s"\n',j,htype);
htype = fits.movRelHDU(fptr,-2);
n = fits.getHDUnum(fptr);
fprintf('HDU %d:  "%s"\n',n,htype);
htype = fits.movRelHDU(fptr,-2);
n = fits.getHDUnum(fptr);
fprintf('HDU %d:  "%s"\n',n,htype);