MathGroup Archive 2001

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

Search the Archive

Re: ReadList


Since you're reading a txt file, it is only fair that you should get
strings. But you can then convert your strings into numbers.

In[1]:=
ToExpression[{"12", "32", "45"}]
Out[1]=
{12, 32, 45}

In[2]:=
Head /@ %
Out[2]=
{Integer, Integer, Integer}

Tomas Garza
Mexico City
----- Original Message -----
From: <Matthias.Bode at oppenheim.de>
To: mathgroup at smc.vnet.net
Subject: [mg27223] [mg27197] ReadList


> Dear Colleagues:
>
> I have to read an external file.txt:
>
> ReadList["D:\theirfile.txt", Record, RecordList->True]//N
>
> This works and yields the appropriately partitioned list  but gives me -
as
> InputForm proves - a list in which the numbers are (expletive deleted)
> words:
>
> mylistoftheirfile = {{"0.001, 0.2, ..."}, {"..."}, ....}
>
> How can I convert the "words" to plain rational numbers that will be
> amenable to a principal component analysis, my ultimate aim?
>
> Thank you for your help.
>
> Best regards,
>
> Matthias Bode
> Sal. Oppenheim jr. & Cie. KGaA
> Koenigsberger Strasse 29
> D-60487 Frankfurt am Main
> GERMANY
> Tel.: +49(0)69 71 34 53 80
> Mobile: +49(0)172 6 74 95 77
> Fax: +49(0)69 71 34 6380
> E-mail: matthias.bode at oppenheim.de
> Internet: http://www.oppenheim.de
>
>
>
>



  • Prev by Date: Problems in rendering Graphics3D with RealTime3D (Mathematica 4.1)
  • Next by Date: Re: ReadList
  • Previous by thread: ReadList
  • Next by thread: Re: ReadList