RE: ReadList
- To: mathgroup at smc.vnet.net
- Subject: [mg18850] RE: [mg18787] ReadList
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Thu, 22 Jul 1999 22:57:48 -0400
- Sender: owner-wri-mathgroup at wolfram.com
James l. Fisher wrote:
-----------------------
I want to read the following data which is in ascii form into a list
09/22/98 12:15 2.36
09/22/98 12:30 2.37
09/22/98 12:45 2.38
How can I use ReadList, or some other command, to enter this into the form
{{09/22/98,12:15,2.36},{09/22/98,12:30,2.37},{09/22/98,12:45, 2.38}}
How could I read each column into a seperate list also.
Thanks
James
------------------------
You can use Import (Version 4.0 only).
In[1]:=
MyData=Import["data.txt","Table"];
---------------
With other versions of Mathematica use ReadList.
In[2]:=
MyData=ReadList["data.txt", {Word,Word,Number}];
----------------
I don't know of a way to read the data as columns, and I doubt you could. I
would read it in using one of the above then use the following:
In[3]:=
Transpose[MyData]
------------------
Regards,
Ted Ersek
ersektr at navair.navy.mil