fitsread - Read data from FITS file

Syntax

data = fitsread(filename)
data = fitsread(filename, extname)
data = fitsread(filename, extname, index)
data = fitsread(filename, 'raw')

Description

data = fitsread(filename) reads the primary data of the Flexible Image Transport System (FITS) file specified by filename. Undefined data values are replaced by NaN. Numeric data are scaled by the slope and intercept values and are always returned in double precision. The filename argument is a string enclosed in single quotes.

data = fitsread(filename, extname) reads data from a FITS file according to the data array or extension specified in extname. You can specify only one extname. The valid choices for extname are shown in the following table.

Data Arrays or Extensions

extname

Description

'primary'

Read data from the primary data array.

'table'

Read data from the ASCII Table extension.

'bintable'

Read data from the Binary Table extension.

'image'

Read data from the Image extension.

'unknown'

Read data from the Unknown extension.

data = fitsread(filename, extname, index) is the same as the above syntax, except that if there is more than one of the specified extension type extname in the file, then only the one at the specified index is read.

data = fitsread(filename, 'raw') reads the primary or extension data of the FITS file, but, unlike the above syntaxes, does not replace undefined data values with NaN and does not scale the data. The data returned has the same class as the data stored in the file.

Example

Read FITS file tst0012.fits into a 109-by-102 matrix called data.

data = fitsread('tst0012.fits');

whos data
  Name       Size           Bytes  Class

  data     109x102          88944  double array

Here is the beginning of the data read from the file.

data(1:5,1:6)
ans =
  135.200  134.9436  134.1752  132.8980  131.1165  128.8378
  137.568  134.9436  134.1752  132.8989  131.1167  126.3343
 135.9946  134.9437  134.1752  132.8989  131.1185  128.1711
 134.0093  134.9440  134.1749  132.8983  131.1201  126.3349
 131.5855  134.9439  134.1749  132.8989  131.1204  126.3356

Read only the Binary Table extension from the file.

data = fitsread('tst0012.fits', 'bintable')

data = 
  Columns 1 through 4
    {11x1 cell}  [11x1 int16]  [11x3 uint8]  [11x2 double]
  Columns 5 through 9
    [11x3 cell]  {11x1 cell}  [11x1 int8]  {11x1 cell}  [11x3 int32]
  Columns 10 through 13
    [11x2 int32]  [11x2 single]  [11x1 double]  [11x1 uint8]

See Also

fitsinfo

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS