0

I have a series of arrays stored within files, which I read in IDL via:

openr,1,file.100

a=assoc(1,fltarr(nptx,npty,nptz))

variable=a(0)

close,1

While this works fine if I know the array size (nptx, npty, nptz), I do not know how to get the dimensions from the files themselves.

i.e. I need to read a file in the above manner with unknown dimensions. How do I find the correct array sizes? Opening the file itself is a mess of symbols.

Any help is greatly appreciated!

asynchronos
  • 583
  • 2
  • 14

1 Answers1

0

There is no way to know what the dimensions and data type are of a binary file without some a priori knowledge. You could potentially make some guesses and see if the results make sense.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • Mike's right - you need more information. However, to help you "guess", you can always find the file size in bytes (using fstat or file_info). If you somehow knew 2 of the 3 dimensions then you could calculate the size of the third dimension. – Chris Torrence Sep 30 '16 at 23:08