append to a file
- To: mathgroup at smc.vnet.net
- Subject: [mg46801] append to a file
- From: Francois Coppex <coppexfrancois at yahoo.fr>
- Date: Tue, 9 Mar 2004 04:30:44 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I would like to append to a text file some values in a row, each time the cell is evaluated.
For instance, I'd like to create a text file containing the values:
a11 a12 a13 a14 a15 a16
a21 a22 a23 a24 a25 a26
a31 a32 a33 a34 a35 a36
a41 a42 a43 a44 a45 a46
where aij denotes the j-th value of the i-th run of the evaluation.
The problem is that I wasn't able to figure out how to append the lines to the file. I'm using the
command
Export["file.txt", {ai1, ai2, ai3, ai4, ai5, ai6}, "Table"];
which obviously overvrites the file each time, so that I only get
ai1 ai2 ai3 ai4 ai5 ai6
for all i. Is there a simple way to append the data to the file (goal: include in a DO loop)?