Learn R Programming

RNetLogo (version 1.0-4)

NLSetPatches: Sets a variable of all patches in the NetLogo world to the values in a matrix.

Description

NLSetPatches is an easy way to set the values of all patches to the values of a matrix.

Usage

NLSetPatches(patch.var, in.matrix, nl.obj=NULL)

Arguments

patch.var

The name of the patch variable to set.

in.matrix

A matrix that represents the NetLogo world (has the same dimensions).

nl.obj

(optional) A string identifying a reference to a NetLogo instance created with NLStart.

Value

No return value.

Details

The matrix must have the same x- and y-dimensions as the NetLogo world, indices beginning with (1,1). The upper-left cell (1,1) of the matrix represents the upper-left patch of the NetLogo world, no matter where the origin of the NetLogo world is set. This function is not available when running NetLogo 3D. Use NLSetPatchSet instead.

See Also

NLReport, NLGetAgentSet, NLGetGraph, NLDfToList

Examples

Run this code

nl.path <- "C:/Program Files/NetLogo 6.0/app"
NLStart(nl.path)
m1 <- matrix(1:1089 , 33)
NLSetPatches("pcolor", m1)

Run the code above in your browser using DataLab