Farsi / Persian
NetLogo Models Library:
Note: If you download the NetLogo application, every model in the Models Library is included.
This model shows how to use NetLogo's
csv extension to load data from and write data to data to CSV files. This allows users to easily output data (e.g. value of turtle variables, result of calculations, etc.) to a standard CSV file.
The GENERATE-TURTLES button just creates 100 random turtles. The user can then use the WRITE-TURTLES-TO-CSV button to save the
heading of each turtle into a CSV file called
If you were interested in generating just one line of this CSV file at a time, you could use the
csv:to-string [ (list xcor ycor size color heading) ] of one-of turtles
The READ-TURTLES-FROM-CSV button does just the opposite: reads this data from
turtles.csv and creates turtles with those properties.
Pressing ASK TURTLES [ DIE ] before READ-TURTLES-FROM-CSV will allow to remove the originally generated turtles and see that they are re-created with their original attributes.