Re: String to numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg55370] Re: String to numbers
- From: "Hans Michel" <hmichel at sdc.cox.net>
- Date: Sun, 20 Mar 2005 04:12:08 -0500 (EST)
- References: <d1gu3b$p0$1@smc.vnet.net>
- Reply-to: "Hans Michel" <hmichel at sdc.cox.net>
- Sender: owner-wri-mathgroup at wolfram.com
John: If your file follows the said format then the following should work DeleteCases[ 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. Hans "Erb, John" <jerb at saint-lukes.org> wrote in message news:d1gu3b$p0$1 at smc.vnet.net... > > 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 prodigy.net > > > 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. >