Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Reading a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25503] Re: [mg25475] Reading a file
  • From: Matt.Johnson at autolivasp.com
  • Date: Thu, 5 Oct 2000 23:50:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Rod-

ReadList is tricky and I usually end up using trial and error to get it
right, but this seems to work for your example.

In[39]:=
!! test.txt
s,1,even,21,2.1,40
p,1,even,7,2.1,3.0
d,1,even,5,2.1,3.0
f,1,even,3,2.1,3.0

In[40]:=
ReadList["test.txt", Record, RecordLists -> True]
Out[40]=
{{"s,1,even,21,2.1,40"}, {"p,1,even,7,2.1,3.0"}, {"d,1,even,5,2.1,3.0"}, \
{"f,1,even,3,2.1,3.0"}}

-matt






Rod <rodolphe6831 at my-deja.com> on 10/02/2000 08:26:55 PM

cc:

Subject: [mg25503]  [mg25475] Reading a file


 I'm trying to read the following file,

s,1,even,21,2.1,40
p,1,even,7,2.1,3.0
d,1,even,5,2.1,3.0
f,1,even,3,2.1,3.0

I want the field separator to be "," so i tried
ReadList
["file",{Character,Number,Word,Number,Number,Number},WordSeparators->
","] but it does not seem to work. Any ideas ?

--
   __   _
  / /  (_)__  __ ____  __
 / /__/ / _ \/ // /\ \/ /  . . .  t h e   c h o i c e  o f   a
/____/_/_//_/\_,_/ /_/\_\              G N U   g e n e r a t i o n . . .


Sent via Deja.com http://www.deja.com/
Before you buy.







  • Prev by Date: "Evaluate to Here" (solved)
  • Next by Date: vector multiplication
  • Previous by thread: Reading a file
  • Next by thread: Re: Reading a file