Next: , Previous: , Up: Data Classes   [Contents][Index]


6.2.5 File Arrays

A FILE ARRAY is a variable that assigns an array type and structure to a disk file, so that you can access and modify the disk file as if it were an array (see Arrays). Since interaction with disk files takes longer than interaction with internal memory, working with file arrays is slower than working with ordinary arrays. However, ordinary arrays are limited in size by the size of your work memory, whereas file arrays are limited in size by the size of your hard disk, which is usually much bigger.

You create a file array by using one of the functions bytfarr, intfarr, lonfarr, fltfarr, dblfarr, cfltfarr, or cdblfarr. (See bytfarr, intfarr, lonfarr, fltfarr, dblfarr, cfltfarr, and cdblfarr.) For instance:

z = FLTFARR('file.dat',200,100)

creates a float file array with dimensions 200 by 100, associated with file file.dat. If the file does not exist yet, then it is created the first time you write data to it. You use a file array just like an ordinary array, except that the + summation flag is not (yet) implemented for file arrays.

File arrays assume that the data values in the disk file have the byte order that is appropriate for the current computer system. FZ files are always stored in little-endian order, so file arrays reading from FZ files currently only works on little-endian machines.