I have previously been using
logf[x_, y_] := f[x, y] /. v_ :>(PutAppend[Unevaluated[f[x, y] = v;], "out.txt"];);
which produces output like
f[1,5]=2.566665345435; on each line of the output file. How could I modify this to produce CSV file, i.e. output lines that look like
1, 5, 2.5666665345435 3, 4, 4.4353453453453 . .
I tried the obvious guess
logf[x_, y_] := f[x, y] /. v_ :>(PutAppend[Unevaluated[x, y, v], "out.txt"];);
but this does not work, as the word "Sequence" also gets exported.
Also is this the best way I can export data from Mathematica to be read in by c++ code or is there a better way?