MathGroup Archive 2007

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

Search the Archive

Re: File reading and writing within for loop


On Nov 28, 4:02 pm, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
wrote:
> 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
>
> nilaak... 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

Thanks everybody. Answers are very good.....

With regards.

nilaakash


  • Prev by Date: solution to undetermined linear equation
  • Next by Date: Re: slot argument weirdness
  • Previous by thread: Re: solution to undetermined linear equation
  • Next by thread: Re: Controlling evaluation