Main Content

matlab.io.fits.deleteFile

Delete FITS file

Syntax

deleteFile(fptr)

Description

deleteFile(fptr) closes and deletes an open FITS file. This can be useful if a FITS file cannot be properly closed.

This function corresponds to the fits_delete_file (ffdelt) function in the CFITSIO library C API.

Examples

import matlab.io.*
srcFile = fullfile(matlabroot,'toolbox','matlab','demos','tst0012.fits');
copyfile(srcFile,'myfile.fits');
fileattrib('myfile.fits','+w');
fptr = fits.openFile('myfile.fits','readwrite');
fits.deleteFile(fptr);
fptrs = fits.getOpenFiles()