MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: help! to input data...

  • To: mathgroup at
  • Subject: [mg4264] Re: help! to input data...
  • From: wagner at (Dave Wagner)
  • Date: Sun, 23 Jun 1996 03:10:11 -0400
  • Organization: University of Colorado, Boulder
  • Sender: owner-wri-mathgroup at

In article <4q09hb$g8c at>,
Paul Abbott  <paul at> wrote:
>Ian Collier wrote:
>> Mathematica's ReadList command does not have any built-in options to
>> read comma-separated data. 
>A not so neat alternative is:
>In[4]:= ReadList["comma.dat", Table[Word,{3}],  WordSeparators->","]

The not-so-neat alternative is required if the data has been output
by a spreadsheet program like excel, which does not represent zero-valued
entries in the file, e.g.,


You need to use

	ReadList["comma.dat", Word, RecordLists->True,

Note that the RecordLists option obviates the need to specify how
many items are on each line.  (In fact, the code shown works even when there
are a different number of items on each line.)

For the above data, you'll get something like this:

	{"1", "", "3",  etc.

When you convert this ToExpression, each "" will turn into Null, which
can easily be replaced with 0's using a rule.

		Dave Wagner
		Principia Consulting
		(303) 786-8371
		dbwagner at


  • Prev by Date: Psfix on in Dos mathematica ??
  • Next by Date: Re: Help with this!!!! please
  • Previous by thread: Re: help! to input data...
  • Next by thread: Re: help! to input data...