Converting output files from 6.4 to 7.0

In 6.4, I had a module create an outfile on setup. In 7.0, the output file no longer prints the headers for the columns. In 6.4 the first line is individual, a-number, b-number, but in 7.0 the first line is deleted and just the data for each turtle is printed. Any ideas what is different in7.0?

The code in 6.4

Hi-

I’m pretty sure that your problem is caused by a bug in NetLogo 7 .0 that was just discovered and fixed over the weekend.

I’m hoping one of the development team will tell you where to get the fixed version of NetLogo 7.0.

I figured it out by rearranging my earlier inelegant code.

This works

Hi @mfugate,

Both you and Steve are correct. There was indeed a bug with file-open and file-print that may have been causing your original code to not work, however it is also true that your revised code is more ideal. You should generally open a file one time per model/run, only closing it once you’re completely done writing data to it. I’m not sure when the next version of NetLogo (containing the relevant bug fixes) will be released, but in the meantime, let us know if you encounter any other issues!

Isaac B.

Thank you. I am encountering another issue with output files with to go. I want to add data to a file on each tick.

This is the setup code in 6.4

This is the go code

This produces an outfile with four columns with headers time, N3, N4, and N5 and fills in the ticks and the numbers of each until go is clicked to stop.

In 7.0, I just get the last tick in the output file and nothing else - no headers - no other tick data. I tried several things and can get the column headers and some data, but the table doesn’t fill entirely - if there are 1000 ticks in the run, it stops are tick ~900.

Setup code in 7.0 to get headers and some data - can’t quite figure if I need to close something

Go code

Any ideas would be appreciated

Hi @mfugate,

This issue is due the same bug that you originally reported, and it has since been fixed for the upcoming release. Sorry for the troubles, but it will be resolved soon!

Isaac B.

Yes, to be clear: There is a bug in NetLogo 7.0.0 where file-* primitives incorrectly open files in “overwrite” mode, rather than “append” mode. Users can work around this by accumulating their desired file text in a variable and only ever writing to the file once. We have implemented a fix for this bug, and it will be available in NetLogo 7.0.1, which is due to be released in the coming week.