Luca G.
Luca G.

Reputation: 29

NETLOGO: storing lists for later use

Hello I am building a model in netlogo which is supposed to run for 525614 ticks and then stop. The result of this model is a list of values. I would like to compare the lists of values given by the model in different runs. Unfortunately every time the model starts running everything is cleared so there is no way of keeping track of the list produced by the model. I tried to write a csv file to store the elements of the list like this:

file-open "list.csv"
file-write list_element

The problem is that when I try to retrieve the list as follows:

show csv:from-file "list.csv"

I get: [[" list_element1 list_element2....."]] instead of:

 [list_element1 list_element2 ....]

The presence of the double square bracket at the beginning and at the end as well as the presence of the quotation marks make it impossible to access a single element of the list to compare it with those of other lists. How should I solve this? Should I use diferent primitives to write my file or should I operate on the badly formatted list I get? The list should be composed of only numbers.

Upvotes: 0

Views: 84

Answers (1)

Alan
Alan

Reputation: 9620

Use file-print instead of file-write.

Upvotes: 2

Related Questions