This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Insert binary table after current HDU




insertBTbl(fptr,nrows,ttype,tform,tunit,extname,pcount) inserts a new binary table extension immediately following the current HDU. Any following extensions are shifted down to make room for the new extension. If there are no other following extensions then the new table extension is simply appended to the end of the file. If the FITS file is currently empty then this routine creates a dummy primary array before appending the table to it. The new extension becomes the CHDU. If there are following extensions in the file and if the table contains variable-length array columns then pcount must specify the expected final size of the data heap. Otherwise, pcount must be zero.

Specify ttype, tform, and tunits as cell array of character vectors or a string array.

This function corresponds to the fits_insert_btbl (ffibin) function in the CFITSIO library C API.


Create a table following the primary array. Then, insert a new table just before it.

fptr = fits.createFile('myfile.fits');
ttype = {'Col1','Col2'};
tform = {'9A','1D'};
tunit = {'m/s','candela'};