MathGroup Archive 1998

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

Search the Archive

Re: Help w/ conversion of txt file to useable form for Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14446] Re: Help w/ conversion of txt file to useable form for Mathematica
  • From: "Dale Horton" <daleh>
  • Date: Wed, 21 Oct 1998 03:32:42 -0400
  • Organization: Wolfram Research, Inc.
  • References: <6vf4mo$dfl@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

This is just a matter of doing a ReadList.

In[1]:=
info = ReadList["test.txt",Record,RecordSeparators->{"\n","(",")"}]
Out[1]=
{"surface_one
3","x","7","3","9","y","2","1","6","x-accel","24","17","2"}

Then manipulating the data into the form you want.

Another way would be

In[2]:=
info = ReadList[
"test.txt",{Record,Record,Number,Number,Number,Record,Number,Number,
     
Number,Record,Number,Number,Number},RecordSeparators->{"\n","(",")"}]
Out[2]=
{{"surface_one 3","x",7,3,9,"y",2,1,6,"x-accel",24,17,2}}

-Dale

Darrmis wrote in message <6vf4mo$dfl at smc.vnet.net>...
>
>Can anyone help me with a problem.  I am using another program which
>outputs a bunch of data into several text files.  For example, an
>outputed file would look like:
>
>((surface_one 3)
>(x
>7
>3
>9
>)
>(y
>2
>1
>6
>)
>(x-accel
>24
>17
>2
>)
>)
>
>Except the number of entries would be several thousand.  Each new line
>is a carriage return.  I would like to get this data into mathematica
>in the form of lists.  For instance, based on the above example, I
>would like to define in mathematica:
>
>xcoord={7,3,9};
>ycoord={2,1,6};
>xaccel={24,17,2};
>
>Does anybody know how to do this easily.  I would be very grateful for
>help.  Thanks.
>
>
>Karl Kevala
>karlk at eng.umd.edu
>



  • Prev by Date: Re: dll's from within....
  • Next by Date: Re: I need some help ...
  • Previous by thread: Help w/ conversion of txt file to useable form for Mathematica
  • Next by thread: Solving simultaneous eqns