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 |