Jesse001
Jesse001

Reputation: 924

Exporting: X, Y and turtle count in netlogo

I'm trying to figure out the relationship my model produces with distance along the x axis, so I'm attempting to export a csv file that contains all combinations of X and Y coordinates, as well as the "density" which is defined as the

 ask patches [set density count turtles-here]

I'm tried simply using

output-print (ask patches [show density])

export-output "file.csv"

but either there's a flaw in my reasoning, or I'm coding it wrong (I do get an error but I'm missing the mistake somewhere). Any help would be much appreciated!

Upvotes: 1

Views: 200

Answers (1)

Bryan Head
Bryan Head

Reputation: 12580

Try this:

file-open "file.csv"
ask patches [
  file-print (word pxcor ", " pycor ", " density)
]
file-close

Upvotes: 3

Related Questions