Main Content

matlab.io.fits.createFile

Create FITS file

Syntax

fptr = createFile(filename)

Description

fptr = createFile(filename) creates a FITS file. An error will be returned if the specified file already exists, unless the filename is prefixed with an exclamation point (!). In that case CFITSIO will overwrite (delete) any existing file with the same name. Specify filename as a character vector or string scalar.

This function corresponds to the fits_create_file (ffinit) function in the CFITSIO library C API.

Examples

Create a new FITS file.

import matlab.io.*
fptr = fits.createFile('myfile.fits');
fits.createImg(fptr,'uint8',[256 512]);
fits.closeFile(fptr);
fitsdisp('myfile.fits');