MathGroup Archive 2005

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

Search the Archive

Re: String to numbers

  • To: mathgroup at
  • Subject: [mg55370] Re: String to numbers
  • From: "Hans Michel" <hmichel at>
  • Date: Sun, 20 Mar 2005 04:12:08 -0500 (EST)
  • References: <d1gu3b$p0$>
  • Reply-to: "Hans Michel" <hmichel at>
  • Sender: owner-wri-mathgroup at


If your file follows the said format then the following should work

ReadList["C:\\data.txt", {Word, Number, Number, Number, Word},
RecordSeparators -> {"\n"}, TokenWords -> {"<", ">"}], _String, {2}]

replace "C:\\data.txt"  with name and path of your own file.


"Erb, John" <jerb at> wrote in message 
news:d1gu3b$p0$1 at
> Hello,
> I have data in file in the form of strings, formatted as:
> <2.54   3.11   2.89>
> <3.58   5.24   5.66>
> ... more
> How can I read this into mathematica, and convert the strings to
> numbers,
> so I would have
> {{2.54,3.11,2.89},{3.58,5.24,5.66},...{}}
> Thank you,
> John C. Erb
> Email:  John_C_Erb at
> Saint Luke's Health System Confidentiality Notice:
> The information contained in this e-mail transmission is confidential
> information, proprietary to the sender and legally protected.  Its purpose
> is intended for the sole use of the individual(s) or entity named in the
> message header.  If you are not the intended recipient, you are hereby
> notified that any dissemination, copying or taking any action in reliance
> on the contents of this information is strictly prohibited.  If you
> received this message in error, please notify the sender of the error and
> delete this message and any attachments.

  • Prev by Date: Re: J/Link problem on Mac OS X
  • Next by Date: Re: findroot
  • Previous by thread: Re: String to numbers
  • Next by thread: Re: String to numbers