Contenuto principale

matlab.io.fits.getColName

Get table column name

Syntax

[colnums,colnames] = matlab.io.fits.getColName(fptr,templt,casesen)

Description

[colnums,colnames] = matlab.io.fits.getColName(fptr,templt,casesen) gets the numbers and names of the table columns whose names match the specified template. By default, the column-name match is case insensitive. If you specify the casesen argument as true, then the column-name match is case sensitive.

Specify the column-name template templt as a string scalar or character vector in one of these three ways:

  • The exact name of the column for which to search.

  • The number of the column for which to search. (The first column has number 1.)

  • A string for which to search containing one or more of these wildcard characters:

    • * — Matches any sequence of zero or more characters

    • ? — Matches any single character

    • # — Matches any sequence of decimal digits (09)

Examples

collapse all

Open a sample FITS file that has a table in the second HDU. Get the numbers and names of all table columns that begin with the letter C. Then close the file.

import matlab.io.*
fptr = fits.openFile("tst0012.fits");
fits.movAbsHDU(fptr,2);
[colnums,colnames] = fits.getColName(fptr,"c*",false)
colnums = 1×5

     3     4     7    11    12

colnames = 1×5 cell
    {'COUNTS'}    {'COOR'}    {'CHANNEL'}    {'Complex'}    {'Cplx_64'}

fits.closeFile(fptr)

Tips

  • This function corresponds to the fits_get_colname (ffgcnn) function in the CFITSIO library C API.

  • To use this function, you must be familiar with the CFITSIO C interface. You can access the CFITSIO documentation at the CFITSIO website.

Extended Capabilities

expand all

Version History

expand all