Re: Read 3D array into IDL [message #39174 is a reply to message #39172] |
Wed, 28 April 2004 12:55   |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Tmorri wrote:
> I have a 3D array [409x233x5] in my C drive, I need to read the data into
> IDL and then process it.
> Could anyone tell me how to read the data?
Not until you explain the precise format of the data. Is the array an
array of integers, floating point numbers, or strings? If it's numeric
data, are the numbers stored as binary data or as ascii text strings? If
binary format is used, how many bytes are used for the numbers? If
it's in text format, what delimiters are used, if any?
In what order to the three dimensions vary? For instance, consider a
2x2x2 array named 'array'. One of the possible orders it could be
printed out in is the following (this is the natural order for IDL):
array[0,0,0] array[1,0,0]
array[0,1,0] array[1,1,0]
array[0,0,1] array[1,0,1]
array[0,1,1] array[1,1,1]
On the assumption that your data is stored as an ascii text file
containing 409*233*5 floating point numbers, with natural IDL dimension
ordering, then the following should do the job quite nicely:
data = FLTARR(409,233,5)
OPENR,infile,'C:\path\name\filename.txt',/GET_LUN
READF,infile,data
CLOSE,infile
|
|
|