You need to open the file in "append" mode. See here:
http://docs.julialang.org/en/latest/stdlib/base/#Base.open
open(file,"a") do x
writecsv(x,data)
end
Then write to it, I believe using writecsv or writedlm work fine on open
files, but I can't confirm write now; otherwise, you'll need to use the
write methods yourself.
-Jacob
On Wed, Mar 5, 2014 at 5:16 PM, Henrik L Nordmark <[email protected]>wrote:
> Dear community,
>
> I apologize if this is very trivial, but I haven't been able to figure
> this out on my own.
>
> I have been looking in the Julia documentation - especially the Text I/O
> section - for a way of appending data to a file. I have a for loop for
> which I would like to append some info to a file at the end of every
> iteration in order to create a log.
>
> I usually use writecsv(*filename*, *A*) when I am looking to write out
> data, but that obviously doesn't work in this context as that would simply
> overwrite a new csv file after every iteration.
>
> If someone could point me in the direction of the correct Julia syntax to
> append data to a file, that would be greatly appreciated.
>
> Kind regards,
> Henrik.
>
>