I suspect that Matlab might be reading the raw byte data out of the file. In IDL, you typically specify the type of data that is supposed to read in from a binary file. For example:
pro dj_forum_2172017_1150
compile_opt idl2
data = dblarr(300,240)
data += 5
help, data
print, data[0:3, 0:3]
openw, lun, "density.dat", /get_lun
writeu, lun, data
close, lun
openr, lun, "density.dat", /get_lun
density = dblarr(300,240, /NOZERO)
readu, lun, density
free_lun, lun
help, density
print, density[0:3, 0:3]
openr, lun, "density.dat", /get_lun
byte_density = bytarr(6,12000, /NOZERO)
readu, lun, byte_density
free_lun, lun
help, byte_density
print, byte_density[0:3, 0:3]
end
This outputs:
DATA DOUBLE = Array[300, 240]
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
DENSITY DOUBLE = Array[300, 240]
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
5.0000000 5.0000000 5.0000000 5.0000000
BYTE_DENSITY BYTE = Array[6, 12000]
0 0 0 0
20 64 0 0
0 0 20 64
0 0 0 0
I am not sure how you specify the data type and dimensions being read from a binary file in Matlab but I suspect that might be the problem.
-David
Harris GS
|