Main Content

matlab.io.fits.movRelHDU

从当前 HDU 移动相对数量的 HDU

语法

htype = moveRelHDU(fptr,nmove)

说明

htype = moveRelHDU(fptr,nmove) 从当前 HDU 向前或向后移动相对数量的 HDU,并返回所生成 HDU 的 HDU 类型 htypehtype 的可能值包括:

'IMAGE_HDU'
'ASCII_TBL'
'BINARY_TBL'

此函数对应于 CFITSIO 库 C API 中的 fits_movrel_hdu (ffmrhd) 函数。

示例

先一个接一个地移动所有 HDU,然后每两个 HDU 向后移动两次。

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);

另请参阅

|