1.11.3 Reading Data Files
Reading numerical data files.
If you have a table of numbers in a file, generated for example by an external program, you can read them into Mathematica using ReadList. The numbers in your file can be given in C or Fortran-like form, as 2.3E5 and so on. ReadList converts all numbers to the appropriate Mathematica form.
This shows the contents of the file rand.dat.
3.4 -5.7E-2 8.4E+2
This reads the file rand.dat, and returns a list of the numbers in the file.
4.5 -7.8E-2 1.9E+3
6.4 -0.1 4.7E+4
In:= ReadList["rand.dat", Number]
This reads the numbers making a separate list for each line in the file.
In:= ReadList["rand.dat", Number, RecordLists -> True]
Mathematica allows you to read files in many different ways. For example, instead of reading numbers, you can read strings or "words". In addition, you can use Find to search for particular parts of files to read. These possibilities are discussed in Section 2.11.7.