Main Content

matlab.io.fits.movRelHDU

現在の HDU からの HDU の相対数の移動

構文

htype = moveRelHDU(fptr,nmove)

説明

htype = moveRelHDU(fptr,nmove) は、現在の HDU から HDU の相対数分を前方または後方に移動し、結果の HDU の HDU タイプ htype を返します。htype には次の値を設定できます。

'IMAGE_HDU'
'ASCII_TBL'
'BINARY_TBL'

この関数は、CFITSIO ライブラリ C API の関数 fits_movrel_hdu (ffmrhd) に相当します。

各 HDU を続けて移動してから、2 つの HDU ずつ後方に 2 回移動します。

import matlab.io.*
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);
end
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);
fits.closeFile(fptr);