GRACE UNDER PRESSURE
  • Blog
  • About
  • Act Now
  • Updates
  • THESIS
  • Contact




BLOG BY GRACE C. YOUNG
                                                             
                                                      

Reading .dat and .hdr Files in MATLAB

7/10/2017

Comments

 
DAT files (.dat) are a common file type containing data. They can be stand-alone files, but are often accompanied by a configuration file such as a header file (.hdr). 

​This summer my team at NASA is working with .dat and .hdr files containing radar data of near-earth asteroids. The files are generated from an asteroid modelling program called SHAPE. 

We are experimenting with preprocessing the data in MATLAB. There wasn't an existing way to straightforwardly ("straightforwardly") work with the .dat files in MATLAB, so we had to write our own script. In that script we use information contained in the .hdr file to read the .dat file as an image. That code is below in case it's useful to somebody. 

EXAMPLE DATA:

run20040918175737.dat
File Size: 1400 kb
File Type: dat
Download File

<- example .dat file 
run20040918175737.hdr
File Size: 0 kb
File Type: hdr
Download File

<- associated .hdr file

MATLAB Script:

dathdrconv.m
File Size: 1 kb
File Type: m
Download File

<- .m file containing the MATLAB function datHdrConv

EXAMPLE RESULTS:

Run the function on example data: 
>> pixval = datHdrConv('data/run20040918175737');
>> imshow(pixval)
Result below.
Picture
>> imshow(pixval, [])
Result below.
Picture

This code was developed with Agata Rożek. Please post any comments below.
Comments

    Author

    Same author, Grace. This is where I make technical notes, usually related to my PhD. My slightly more exciting blog, Grace Under Pressure, is here. 

Powered by Create your own unique website with customizable templates.