Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

trying to pull numbers out of a string from a file...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36595] trying to pull numbers out of a string from a file...
  • From: "1.156" <rob at piovere.com>
  • Date: Fri, 13 Sep 2002 01:14:28 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I've got to extract some numbers from a file that are in lines of text. Since the line contents are not numbers, I presume I must pull the line out as a string.  Here I start by pulling out just one line:

inFile = OpenRead["197-tst.txt"]
y = ReadList[inFile, String, 1, RecordLists -> True]
Close[inFile];

This appears to pull in a line. Now I want to take characters 25 to 110 to get just the stuff I want:
y1=StringTake[y ,{25,110}];

Here's the output.  StringTake doesn't seem to work.

StringTake[{aEX-004   2002197 0 0 0 5935.80 5946.66  27.06 -1281.9   -229.    321.    317.    367.   -115.    126.    146.   -410.  -426.000000EF   75.}, {25, 110}]

It doesn't take loading another package as far
as I can tell from the help.  I'm thinking that it doesn't work because it's trying to work on a list
rather than a string. I've tried Flatten, and other stuff to try to get to just a string and not a list but
nothing has worked so far.  I'm a long way from getting to those numbers in there but heck, I
can't even get to the string.  Can anyone point me in the right direction?

Thanks, Rob



  • Prev by Date: RE: Re: A symbol for Floor
  • Next by Date: Re: MathematicaTeX
  • Previous by thread: Mathreader Linux Installation: No file exists for resource 318
  • Next by thread: Re: trying to pull numbers out of a string from a file...