MathGroup Archive 2007

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

Search the Archive

Re: File reading and writing within for loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83701] Re: File reading and writing within for loop
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 28 Nov 2007 05:44:05 -0500 (EST)
  • References: <figv8v$g0e$1@smc.vnet.net>

Hi,

filename[i_Integer] :=
  "in_" <> StringTake[
    ToString[PaddedForm[i, 2, NumberPadding -> {"0", "0"}]], -2] <>
   ".dat"

iolst={#, StringReplace[#, "in" -> "out"]} & /@
  Table[filename[i], {i, 0, 50}]

doSomething[{in_String,out_String}]:=Module[{dta}
    dta=Import[in];
    Export[out,dta]
   ]

and

no loop with

doSomething /@ iolst


Regards
   Jens

nilaakash at gmail.com wrote:
> Hi,
>     Suppose I have 50 files like following names, in_00.dat,
> in_01.dat, in_02.dat, ........
> I want to read all the files, manipulate and save output like
> out_00.dat, out_01.dat, out_02.dat..... within a "for" loop. Could you
> please suggest how to do these ? If you have answer without "for" loop
> is also OK.
> 
> Thanks in advance.
> With regards.
> nilaakash
> 


  • Prev by Date: Re: File reading and writing within for loop
  • Next by Date: Re: Stream programming
  • Previous by thread: Re: File reading and writing within for loop
  • Next by thread: Re: File reading and writing within for loop