Nell
Nell

Reputation: 559

Reading a string variable "NaN" in NetLogo

Why do I obtain :

observer> show count patches with [pcolor = green and ID-polygon = "NaN"]
observer: 0

While I have one patch with [pcolor = green and ID-polygon = "NaN"] in my landscape ?

enter image description here

Thanks for your help.

Upvotes: 2

Views: 779

Answers (1)

Seth Tisue
Seth Tisue

Reputation: 30453

That NaN isn't a string. It's "not a number", which is a numeric value which is supposed to be impossible to obtain in NetLogo.

Are you using the GIS extension?

One way you could get NaN is if you're using an extension that doesn't following the usual NetLogo rule disallowing NaN values. The GIS extension is one such extension. See http://ccl.northwestern.edu/netlogo/5.1.0/docs/gis.html#gis:raster-sample for details, including sample code for detecting NaN values. (You could encapsulate the logic for this in a procedure.)

Upvotes: 3

Related Questions