MathGroup Archive 2005

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

Search the Archive

Reading in a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57024] Reading in a file
  • From: Swati Shah <swatshah at gmail.com>
  • Date: Thu, 12 May 2005 02:34:23 -0400 (EDT)
  • Reply-to: Swati Shah <swatshah at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi everyone,
I have the following file named "temp.txt"
with the following format:

;  Restart file created by make.m
;
NYTOT        140
STTOT         30
;
TIME 0.00000000000000
3.1     4.1
2.3    4.5
3.3     2.5
1.1    4.1

I want to read this file in, but store the value of NYTOT which is 140
in a variable nytot, sttot in another variable named sttot

At the end, I would like the get
nytot = 140
sttot = 30
time = 0.0

and the rest of the values in another list:
tmpLst = {3.1,4.1,2.3,4.5,3.3,2.5,1.1,4.1}

I have done the following so far:

tmpLst=Flatten[Select[Import["temp.txt", "Table"], NumericQ[First[#]] &]];
Which gives the tmpLst values but am not sure how I can get the sttot,
nytot and time values?

Any ideas?

Thanks in advance


  • Prev by Date: Re: calculate de Jong function
  • Next by Date: Re: calculate de Jong function
  • Previous by thread: dsolve?
  • Next by thread: Re: Reading in a file