23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Flexible Image Transport System (FITS) Files<br />

PrimaryData: [1x1 struct]<br />

BinaryTable: [1x1 struct]<br />

Unknown: [1x1 struct]<br />

Image: [1x1 struct]<br />

AsciiTable: [1x1 struct]<br />

Importing Data from a FITS File<br />

To import data into the <strong>MATLAB</strong> workspace from a FITS file, use the<br />

fitsread function. Using this function, you can import the data in the<br />

PrimaryData sectionofthefileoryoucanimportthedatainanyofthe<br />

extensions in the file, such as the Image extension. This example illustrates<br />

how to use the fitsread function to read data from a FITS file:<br />

1 Determine which extensions the FITS file contains, using the fitsinfo<br />

function.<br />

info = fitsinfo('tst0012.fits')<br />

info =<br />

Filename: 'tst0012.fits'<br />

FileModDate: '12-Mar-2001 18:37:46'<br />

FileSize: 109440<br />

Contents: {1x5 cell}<br />

PrimaryData: [1x1 struct]<br />

BinaryTable: [1x1 struct]<br />

Unknown: [1x1 struct]<br />

Image: [1x1 struct]<br />

AsciiTable: [1x1 struct]<br />

The info structure shows that the file contains several extensions<br />

including the BinaryTable, AsciiTable, andImage extensions.<br />

2 Read data from the file.<br />

To read the PrimaryData in the file, specify the filename as the only<br />

argument:<br />

pdata = fitsread('tst0012.fits');<br />

7-9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!