Quantcast

Documentation Center

  • Trial Software
  • Product Updates

matlab.io.fits.createImg

Create FITS image

Syntax

createImg(fptr,bitpix,naxes)

Description

createImg(fptr,bitpix,naxes) creates a new primary image or image extension with a specified datatype bitpix and size naxes. If the FITS file is currently empty then a primary array is created, otherwise a new image extension is appended to the file.

The first two elements of naxes correspond to the NAXIS2 and NAXIS1 keywords, while any additional elements correspond to the NAXIS3, NAXIS4 ... NAXISn keywords.

The datatype bitpix may be given as either a CFITSIO name or as the corresponding MATLAB® datatype.

'byte_img''uint8'
'short_img''int16'
'long_img''int32'
'longlong_img''int64'
'float_img''single'
'double_img''double'

This function corresponds to the fits_create_imgll (ffcrimll) function in the CFITSIO library C API.

Examples

Create two images in a new FITS file. There are 100 rows (NAXIS2 keyword) and 200 columns (NAXIS1 keyword) in the first image, and 256 rows (NAXIS2 keyword), 512 columns (NAXIS1 keyword), and 3 planes (NAXIS3 keyword) in the second image.

import matlab.io.*
fptr = fits.createFile('myfile.fits');
fits.createImg(fptr,'int16',[100 200]);
fits.createImg(fptr,'byte_img',[256 512 3]);
fits.closeFile(fptr);
fitsdisp('myfile.fits');

See Also

| | | |

Was this topic helpful?