NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

File Output Example

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

This code example shows how to output information to an outside file directly from NetLogo code. All the data is written in human readable form using file-print.

The example creates 15 random turtles and opens a new text file of the user's choice. Each turtle has an internal variable, value. Then every time go runs, it will move the turtles randomly and change value. The turtles' patch coordinates and value variable are stored in the opened file. You should close the file when you are finished using the FILE-CLOSE button. The data file can be viewed afterwards using any text editor.

RELATED MODELS

File Input Example

(back to the NetLogo Models Library)