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. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Create new ASCII or binary table extension


fptr = createTbl(fptr,tbltype,nrows,ttype,tform,tunit,extname)


fptr = createTbl(fptr,tbltype,nrows,ttype,tform,tunit,extname) creates a new ASCII or bintable table extension. ttype must be either 'binary' or 'ascii'. The nrows argument gives the initial number of rows to be created in the table and should normally be zero. tunit specifies the units for each column, but can be an empty cell array if no units are desired. extname specifies the extension name, but can be omitted.

tform specifies the format of the column. For binary tables, the values should be in the form of 'rt', where 'r' is the repeat count and 't' is one of the following letters.

'A'ASCII character
'B'Byte or uint8
'C'Complex (single precision)
'D'Double precision
'E'Single precision
'M'Complex (double precision)
'X'Bit (int8 zeros and ones)

A column can also be specified as having variable-width if the tform value has the form '1Pt' or '1Qt', where 't' specifies the data type as above.

For ASCII tables, the tform values take the form:

Iwint16 column with width 'w'
AwASCII column with width 'w'
Fww.ddFixed point
Eww.dd Single precision with width 'ww' and precision 'dd'
Dww.ddDouble precision with width 'ww' and precision 'dd'

This function corresponds to the fits_create_tbl (ffcrtb) function in the CFITSIO library C API.


Create a binary table. The first column contains strings of nine characters each. The second column contains four-element sequences of bits. The third column contains three-element sequences of uint8 values. The fourth column contains double-precision scalars.

fptr = fits.createFile('myfile.fits');
ttype = {'Col1','Col2','Col3','Col4'};
tform = {'9A','4X','3B','1D'};
tunit = {'m/s','kg','kg/m^3','candela'};

Create a two-column table where the first column has a single double-precision value, but the second column has a variable-length double-precision value.

fptr = fits.createFile('myfile2.fits');
ttype = {'Col1','Col2'};
tform = {'1D','1PD'};
Was this topic helpful?