Main Content

Table column name


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


[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).


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

fptr = fits.openFile('tst0012.fits');
[nums,names] = fits.getColName(fptr,'C*');