Reputation: 105
I am fairly new to netlogo and modelling as a whole., but I am really enjoying it. Right now I am stuck…In my model I have breeds, each breed has “x” turtles, every turtle has a “x” variables, until this point I managed to get the value of each turtle and the value of all of them together but I cannot figure it out how to get the value of all the breeds together. I hope you can help me I really appreciate it.
This is the way i got the sum of the variables of the turtles.
show sum [(electricidad) + (transporte) + (prevención) + (atención)] of CM / Comercio.
In order to obtain the sum of breeds i tried
show sum [(SPA) + (SAT) + (SS) + (TT) + (CM) / 5]
The letters inside the "()" are the names of the breeds.
Upvotes: 3
Views: 164
Reputation: 8854
Do all of the breeds have the same variables? In that case you can use:
sum [electricidad + transporte + prevención + atención] of turtles
If there are different variables for different breeds, you can use something like:
(sum [x + y + z] of SPA) + (sum [a + b + c] of SAT) + ...
The parentheses in the preceding line aren't needed, but they might make the code easier to read. The parentheses in your example aren't needed and should probably be left out, unless you have a special reason to include them.
Upvotes: 3