Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: FileNames[] in a loop..

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62085] Re: FileNames[] in a loop..
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 11 Nov 2005 02:51:48 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <dkuuru$7ga$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) the For[] loop syntax is
For[i=1,i<=Length[dateien],i++,
  str=OpenRead[dateien[[i]]];
  ---- Reading of parameters ---
  Close[str];
  -----calculations---
]
  the meaning of "," ans ";" is just reversed,

b) a compound expression is build with ";" beween 
the function calls
   and not with a list construction "{" "}"

c) 
Block[{str},str=OpenRead[#];ReadParameters[];Close[str];DoCalculations[]] 
& /@ dateien

   will work with out any explicit For[] loop

Regards
  Jens

"Uli Würfel" <uli.wuerfel at fmf.uni-freiburg.de> 
schrieb im Newsbeitrag 
news:dkuuru$7ga$1 at smc.vnet.net...
| Hello Experts,
|
| 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:
|
| For[i=1,i<=Length[dateien],
| {
|  str=OpenRead[dateien[[i]]];
|  ---- Reading of parameters ---
|  Close[str];
|  -----calculations---
| };
| i++]
|
| Unfortunately, it does not work.
| Could you help?
|
| Greetings,
| Uli
| 



  • Prev by Date: Re: FileNamesin a loop..
  • Next by Date: Re: FileNames[] in a loop..
  • Previous by thread: FileNames[] in a loop..
  • Next by thread: Re: FileNames[] in a loop..