Acessing variables from turtles in agentset

Viewed 51

Suppose each turtle have a variable. If I want to access the neighbors of a turtle, I should use:

turtles-on neighbors

This will create an agentset for each turtle. How do I create a list that contains the value of variablein each turtle? My intent is to find the mean value of variable from a given "neighborhood".

Thanks!

1 Answers

The idea is that I should first define the neighborhood as a local variable

let neighborhood turtles-on neighbors

This will allow me to use the newly defined object the way I want. If I want the mean of that object, then:

mean [variable] of neighborhood

Although trivial, I hope this helps somebody in the future.

Related