I have a binary file that I need to read into IDL. It has a structure:
80 byte header [string]
4 byte [integer]
then for as many times as are equal to the above integer:
12*4 byte [floats]
2 bytes unused ('padding')
What I wish to do is to read in the header, the integer, then read the floating point numbers into arrays of length of the integer. Unfortunately, IDL documentation (and I will not mince words) is absolute crap, and I cannot figure out how to implement this even though I have what I want to do in terms of sequential byte reads and loops written in pseudocode in a small patch on my whiteboard, namely:
read 80 bytes => header
read 4 bytes => integer
for I=1,integer:
read 4 bytes => float 1
(repeat up to float12)
put float1,2,3 into array1
put float4,5,6 into array2
etc.
ignore two bytes
end for
Does anybody know how to read in binary data like that described above? (Incidentally, the data structure I describe above is a MAJOR file format used in visualisation, and I am not at all pleased that I cannot get IDL to handle it as easily as most packages.)
|