Re: ReadList and FortranForm data
- To: mathgroup at smc.vnet.net
- Subject: [mg8487] Re: ReadList and FortranForm data
- From: sergio at scisun.sci.ccny.cuny.edu (Sergio Rojas)
- Date: Tue, 2 Sep 1997 16:15:29 -0400
- Organization: City College Of New York - Science
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
You may try:
ReadList["data.dat",Table[Number,{i,1,4}]]
which is the same as:
ReadList["data.dat",{Number, Number, Number, Number}]
For more details, though not too clear ones, see Pg 156 of
Mathematica book, edition of 1988.
Rojas
E-mail: sergio at scisun.sci.ccny.cuny.edu
Sean Ross (seanross at worldnet.att.net) wrote:
: I have never been able to figure out how to read in data from a text
: file that is separated by spaces with return characters at the end of
: each line. ie
: 1 2 3 4
: 5 6 7 8
: etc.
: The big problem is that Mma interprets the spaces as multiplication
: operators. I have tried specifying spaces as WordSeparators,
: RecordSeparators, but have not been successful. My work-around is to
: read the whole thing in as a String using the Word option, then manually
: put commas in where the spaces were and use ToExpression to convert to
: numbers again. Unfortunately, this method fails with Fortran-like data
: since the e-01 are interpreted as exponentials. Can someone give me the
: syntax to read in space separated data please.