I was wondering if there was a way to write data to a file, during a Do loop, without having to wait till the end.
I have written a code which scans over many parameters which get plugged into many formulae. I then have a condition on a particular output value which decides if I append the data point to my list.
I run a 'Do' loop for a certain number of iterations, and each time the condition is met the values of that point gets appended to my list.
At the end of the Do loop, i export the list to a .txt file.
Is there a way to get Mathematica to write the data point values to a .txt file as it runs the Do loop... so that it is constantly updating the list?
The reason I was hoping to so this is that if the computer crashes (say after its been running for a whole day!) then I don't lose all the points as they remain in the txt file.
I tried to put the export command in the Do loop but mathemtica didn't seem to like that.
I'm new to mathematica, I've only been using it for the last two weeks... i've tried googling and searching posts on this site for some information but can't find anything... maybe that's because this feature doesn't exist?... if someone could let me know either way that would be great cheers!