MathGroup Archive 2005

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

Search the Archive

Re: FileNamesin a loop..

  • To: mathgroup at
  • Subject: [mg62096] Re: FileNamesin a loop..
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 11 Nov 2005 02:52:00 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 11/10/05 at 2:50 AM, uli.wuerfel at (Uli Würfel)

>I want to carry out the same calculation repeatedly, but with
>different sets of parameters. The parameters are located in files
>and I tried to use

>dateien = FileNames["para*.txt"]

>Then, I wanted to use a simple loop in the way:

>  str=OpenRead[dateien[[i]]];
>  ---- Reading of parameters ---
>  Close[str];
>  -----calculations---

>Unfortunately, it does not work. Could you help?

What you have outlined above should work. The fact that it doesn't work indicates the problem is with the parts of the code you didn't post. So without additional detail, it is impossible to identify the issue. However, it might be worth pointing out the For loop isn't needed. Instead you could structure things as follows:

parameterReadFunction[filename_String]:= ...
caluculationFunction[parameters...]:= ...


One of the advantages of structuring the code this way is it makes it easier to debug.
To reply via email subtract one hundred and four

  • Prev by Date: Re: ((a&&b)||c)==((a||c)&&(b||c)) is not true
  • Next by Date: Re: FileNames[] in a loop..
  • Previous by thread: Re: Integrate problem?
  • Next by thread: Re: FileNamesin a loop..