Re: Problems in writing into a sequential filename
- To: mathgroup at smc.vnet.net
- Subject: [mg97078] Re: Problems in writing into a sequential filename
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 5 Mar 2009 04:51:20 -0500 (EST)
- Organization: Uni Leipzig
- References: <golquh$qab$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, Do[ Nomfich = "c:/temp/RappSr" <> ToString[Sr] <> ".dat"; Print[Nomfich]; poiuy4 = OpenWrite[Nomfich]; Write[poiuy4, Sr]; Write[poiuy4, 1]; Close[poiuy4];, {Sr, {0.5, 1}}]; ?? Regards Jens xabart at gmail.com wrote: > Hi everybody > > I am enjoying the beautiful rules of programming in mathematica, and I > step onto a rock: > How can I write datas into a sequential filename? > Let's explain myself, with an exemple below: > > First I work on mathematica 6.0.2 on linux > > I want to make a Do loop in witch I choose values for a variable: Sr > (here, 0.5 and 1) > Then I concatenate a "pattern" and the value (here RappSr and the > value) and put the name into a variable (Nomfich) > then I open the file (It works) > But then, the problem is it does not write into the file, but it close > it normally. > > So How can I do this not-so-tricky-thing in Mathematica? > > And by the way, I can't plot graphes into any Loop neither. > > Thanks for all your help, > Cheers > Xavier > > The code: > > ClearAll["Global`*"]; > Do[ > Nomfich = ToString["RappSr" <> ToString[Sr]]; > > Print[Nomfich]; > poiuy4 = OpenWrite[Nomfich]; > > Sr >>> Nomfich; > 1 >>> Nomfich; > Close[Nomfich]; > > , {Sr, {0.5, 1}}]; >