matlab.io.fits.readCol
Read rows of ASCII or binary table column
Syntax
[coldata,nullval] = readCol(fptr,colnum)
[coldata,nullval] = readCol(fptr,colnum,firstrow,numrows)
Description
[coldata,nullval] = readCol(fptr,colnum)
reads
an entire column from an ASCII or binary table column. nullval
is
a logical array specifying if a particular element of coldata
should
be treated as undefined. It is the same size as coldata
.
[coldata,nullval] = readCol(fptr,colnum,firstrow,numrows)
reads
a subsection of rows from an ASCII or binary table column.
The MATLAB® data type returned by readCol
corresponds
to the data type returned by getEqColType
.
This function corresponds to the fits_read_col (ffgcv)
function
in the CFITSIO library C API.
Examples
Read an entire column.
import matlab.io.* fptr = fits.openFile('tst0012.fits'); fits.movAbsHDU(fptr,2); colnum = fits.getColName(fptr,'flux'); fluxdata = fits.readCol(fptr,colnum); fits.closeFile(fptr);
Read the first five rows in a column.
import matlab.io.* fptr = fits.openFile('tst0012.fits'); fits.movAbsHDU(fptr,2); colnum = fits.getColName(fptr,'flux'); fluxdata = fits.readCol(fptr,colnum,1,5); fits.closeFile(fptr);