netlogo多乌龟的品种变量
我正忙于绘制一个组织治疗的儿童(Turtle Breed 2)的儿童人数(Turtle Breed 2)。这些组织拥有一个乌龟拥有的变量,称为儿童处理的
,其中所有的孩子都在接受处理。
在“绘图更新命令”中,我现在有:
ask organizations [
create-temporary-plot-pen (word who)
set-plot-pen-color color
plot [length children-treated]
]
但是,一条错误消息说
在这里期待一个数字,而不是列表或块
我尚不清楚该错误适用哪个位置。
有必要使此自动变速器,而不是手动不同的绘图笔,因为可以通过滑块调整组织的数量。
I'm busy trying to plot the number of children (turtle breed 1) treated by an organisation (turtle breed 2). The organisations have a turtles-own variable called children-treated
where all the children are stored which are being treated.
In the 'plot update commands' I now have:
ask organizations [
create-temporary-plot-pen (word who)
set-plot-pen-color color
plot [length children-treated]
]
However, an error message says
Expected a number here, rather than a list or block
It is not clear to me to which place this error applies.
It is necessary to make this automatic, and not manually the different plot pens, as the number of organisations can be adjusted by a slider.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如您所见/code> is plot number ,没有方括号(在Netlogo中标识列表或命令块)。您的
长度为儿童处理的
是一个数字(我知道condry preated
是一个列表),因此您无需将其包装在方括号中:最多最多您可以使用括号以实现可读性:
As you can see here, the syntax for
plot
is plot number, without square brackets (that in NetLogo identify a list or a block of commands). Yourlength children-treated
is a number (so I understand thatchildren-treated
is a list), so you don't need to enclose it in square brackets:At most you can use parentheses for the purpose of readability: