i wonder if any netlogo expert can help me with the following: supposed my patches have 2 attributes (attr1 and attr2, say) and i need to compute a function of both attributes, as in this silly example
patches-own [ attr1 attr2]
to setup
clear-all
ask patches [set attr1 random 10]
ask patches [set attr2 random 20]
let mean-1 mean [attr1] of patches
let mean-2 mean [attr2] of patches
show mean-1
show mean-2
end
i would like to write a procedure which computes the mean (say) of any attribute i pass to it. something like:
ask patches [set attr1 random 10]
ask patches [set attr2 random 20]
compute-mean attr1
compute-mean attr2
end
to compute-mean #attr
let mean-1 mean [#attr] of patches
show mean-1
end
would anyone be able to help? thank you in advance