Documentation Center

  • Trial Software
  • Product Updates

matlab.io.fits.insertImg

Insert FITS image after current image

Syntax

insertImage(fptr,bitpix,naxes)

Description

insertImage(fptr,bitpix,naxes) inserts a new image extension immediately following the current HDU. If the file has just been created, a new primary array is inserted at the beginning of the file. Any following extensions in the file will be shifted down to make room for the new extension. If the current HDU is the last HDU in the file, then the new image extension will be appended to the end of the file.

This function corresponds to the fits_insert_imgll (ffiimgll) function in the CFITSIO library C API.

Examples

Create a 150x300 image between the 1st and 2nd images in a FITS file.

import matlab.io.*
fptr = fits.createFile('myfile.fits');
fits.createImg(fptr,'byte_img',[100 200]);
fits.createImg(fptr,'byte_img',[200 400]);
fits.movAbsHDU(fptr,1);
fits.insertImg(fptr,'byte_img',[150 300]);
fits.closeFile(fptr);
fitsdisp('myfile.fits','mode','min');

See Also

Was this topic helpful?