Main Content

matlab.io.fits.getColName

Get table column name

Syntax

[colnum,colname] = getColNum(fptr,templt,casesen)

Description

[colnum,colname] = getColNum(fptr,templt,casesen) gets the table column numbers and names of the columns whose names match an input template name. If casesen is true, then the column name match is case-sensitive. casesen defaults to false.

Specify the input column name template templt as a character vector or string scalar. templt may be either the exact name of the column to be searched for, or it may contain wildcard characters (*, ?, or #), or it may contain the integer number of the desired column (with the first column = 1). The '*' wildcard character matches any sequence of characters (including zero characters) and the '?' character matches any single character. The # wildcard matches any sequence of consecutive decimal digit characters (0-9).

Examples

Return all the columns starting with the letter 'C'.

import matlab.io.*
fptr = fits.openFile('tst0012.fits');
fits.movAbsHDU(fptr,2);
[nums,names] = fits.getColName(fptr,'C*');
fits.closeFile(fptr);