matlab.io.fits.deleteHDU
FITS 파일에서 현재 HDU 삭제
구문
HDU_TYPE = deleteHDU(fptr)
설명
HDU_TYPE = deleteHDU(fptr)
은 FITS 파일에서 현재 HDU를 삭제합니다. 이후의 파일 내 모든 HDU는 앞으로 이동되어, 삭제된 HDU로 인해 생긴 간격을 메웁니다. 파일의 첫 번째 HDU인 주 배열(Primary Array)을 삭제하는 경우, 현재 주 배열이 null 주 배열로 대체됩니다. 여기서 null 주 배열은 필요한 키워드의 최소 집합을 포함하고 데이터를 포함하지 않습니다. 파일에서 삭제할 HDU 다음에 HDU가 더 있는 경우 현재 HDU는 다음 HDU를 가리키도록 재정의됩니다. 다음에 오는 HDU가 없는 경우 현재 HDU는 이전 HDU를 가리키도록 재정의됩니다. HDU_TYPE
은 새로운 현재 HDU의 유형을 반환합니다.
이 함수는 CFITSIO 라이브러리 C API의 fits_delete_hdu (ffdhdu)
함수에 대응합니다.
예제
FITS 파일에서 두 번째 HDU를 삭제합니다.
import matlab.io.* srcFile = fullfile(matlabroot,'toolbox','matlab','demos','tst0012.fits'); copyfile(srcFile,'myfile.fits'); fileattrib('myfile.fits','+w'); fitsdisp('myfile.fits','mode','min'); fptr = fits.openFile('myfile.fits','readwrite'); fits.movAbsHDU(fptr,2); new_current_hdu = fits.deleteHDU(fptr); fits.closeFile(fptr); fitsdisp('myfile.fits','mode','min');