Re: help! to input data...
- To: mathgroup at smc.vnet.net
- Subject: [mg4242] Re: help! to input data...
- From: vvs124 at rsphy1.anu.edu.au (Victoria.Steblina) (Victoria Steblina)
- Date: Sun, 23 Jun 1996 03:06:17 -0400
- Organization: Optical Sciences Centre, ANU
- Sender: owner-wri-mathgroup at wolfram.com
> I thought i was pretty good at the basics of mathematica, but today i
> tried to input some numerical data that was comma delimited. i.e.
>
> 456,-45,21,0,5
> 43,25,3,66,65
Say, this is your input sitting in the file "data":
456,-45,21,0,5
43,25,3,66,65
In[37]:= in1 = OpenRead["data"]
This reads it first as a set of strings and then converts to a single
string:
In[38]:= in2 = ReadList[in1, String] // ToString
Out[38]= {456,-45,21,0,5, 43,25,3,66,65}
This output now looks like a conventional list of numbers but is still
a string. Gotta convert this data string to a list of numbers and check
with
ListPlot:
In[39]:= ListPlot[ ToExpression[in2] ]
Out[39]= -Graphics-
P.S. I just saw Ian Collier replied to this question but decided to
post
it anyway, it is kind of short :)
Hope it is of assistance
Regards,
Vicki
________________________________________________________________________
Victoria Steblina Email: vvs124 at rsphy1.anu.edu.au
Optical Sciences Centre Tel: 61 6 249 5129
Australian National University Fax: 61 6 249 5184
Canberra, ACT 0200, Australia
==== [MESSAGE SEPARATOR] ====