File Exchange

image thumbnail


version (8.24 KB) by Roberto Abraham
These files read, write, and scan the headers of FITS files.


Updated 12 Aug 1999

No License

These files read, write, and scan the headers of FITS files. FITS is a standard format for astonomical images. All of the files
should be self-documenting with the MATLAB 'help' command. The on-line help also includes examples of usage.

The files have been tested on Matlab v. 5.2, and 5.3.

Cite As

Roberto Abraham (2020). fits (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)

The fitsinfo/fitsread are now part of Matlab, but no Write, so this contribution is excellent.


if you have fitsheader search for a specific keyword, it doesn't properly close the file. adding 'fclose(file)' to line 73 in 'fitsheader.m' seems to solve the problem. otherwise, works great.



Jiaxin Han

FITS file is always in BIG-ENDIAN format, so one DO NOT need to determine the endianness from computer; instead you need to ALWAYS set bswap='b' when write and read.

Jiaxin Han

so you need to ALWAYS set bswap='b'

I only need 2D arrays so it works for me, thanks!

Thanks for the great fitswrite.m file, Roberto. I added

elseif strmatch(friend,'GLNX86')

bswap = 'b';

to get it to work on my computer :)

zhirong zeng

Olivier Berné

Good for handling simple fits files, but does not handle cubes (ie 3d arrays).

ado ado

Perfect for FITS manipulation

MATLAB Release Compatibility
Created with R10
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags