Read data from FITS file
data = fitsread(filename)
data = fitsread(filename,extname)
data = fitsread(filename,extname,index)
data = fitsread(filename,Name,Value)
data = fitsread(filename)
reads the primary data of
the Flexible Image Transport System (FITS) file. filename
is specified as a
character vector or string scalar. The function replaces undefined data values with
NaN
and scales numeric data by the slope and intercept values, always
returning double precision values.
data = fitsread(filename,extname)
reads
data from the FITS file extension specified by extname
.
data = fitsread(filename,extname,index)
reads
data from the FITS file extension specified by extname
.
If there is more than one of the specified extensions in the file, index
specifies
the one to read.
reads
data from the FITS file with additional options specified by one or
more data
= fitsread(filename
,Name,Value
)Name,Value
pair arguments.
|
Character vector or string scalar specifying the name of a FITS file. | ||||||||||||
|
The name of a data array or extension in the FITS file, specified as one of the character
vectors or string scalars in the table that follows. To determine the contents of a FITS, view
the Data Arrays or Extensions
| ||||||||||||
|
Numeric value specifying which extension to read, if more than one exists in the file. |
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
|
Note Using the
|
|
Cell array |
|
Specifies that |
|
Vector of 1-based indices specifying the columns to read from the ASCII or Binary table extension. This vector should contain unique and valid indices into the table data specified in increasing order. This parameter is valid only for ASCII or Binary extensions. |
|
Vector of 1-based indices specifying the rows to read from the ASCII or Binary table extension. This vector should contain unique and valid indices into the table data specified in increasing order. This parameter is valid only for ASCII or Binary extensions. |
|
Data returned from the FITS file. |
Read primary data from FITS file
data = fitsread('tst0012.fits'); Name Size Bytes Class Attributes data 109x102 88944 double
Inspect available extensions, read 'image' extension using the extname
option.
info = fitsinfo('tst0012.fits'); % List of contents, includes any extensions if present. disp(info.Contents); imageData = fitsread('tst0012.fits','image');
Subsample the fifth plane of 'image' extension by 2.
info = fitsinfo('tst0012.fits'); rowend = info.Image.Size(1); colend = info.Image.Size(2); primaryData = fitsread('tst0012.fits','image',... 'Info', info,... 'PixelRegion',{[1 2 rowend], [1 2 colend], 5 });
Read every other row from an ASCII table.
info = fitsinfo('tst0012.fits'); rowend = info.AsciiTable.Rows; tableData = fitsread('tst0012.fits','asciitable',... 'Info',info,... 'TableRows',[1:2:rowend]);
Read all data for the first, second and fifth columns of the Binary table.
info = fitsinfo('tst0012.fits'); rowend = info.BinaryTable.Rows; tableData = fitsread('tst0012.fits','binarytable',... 'Info',info,... 'TableColumns',[1 2 5]);