Problems in writing into a sequential filename
- To: mathgroup at smc.vnet.net
- Subject: [mg97051] Problems in writing into a sequential filename
- From: xabart at gmail.com
- Date: Wed, 4 Mar 2009 07:10:09 -0500 (EST)
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}}];