本文介绍了NetLogo 为补丁块命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想命名为肉类市场";和替代市场"到左下角和右上角的两个街区.我尝试使用 ask market-patches [ set plabel "Meat Market"] ask market-patches1 [ set plabel "Substitutes Market"] 但结果是这样的:在此处输入图片描述

I want to give the names "Meat Market" and "Substitutes Market" to the two blocks bottom left and top right. I tried to use ask market-patches [ set plabel "Meat Market"] ask market-patches1 [ set plabel "Substitutes Market"]but the results was this:enter image description here

market-patches 和 market-patches1 都是全局变量.当它执行代码时,它可能会写成Meat Market"和替代市场"对于每个补丁,但我想要的是一个大的肉类市场";和替代市场"分别为每个蓝色方块.我怎样才能避免这种情况?

market-patches and market-patches1 are both global variables. When it executes the code it probably writes "Meat Market" and "Substitutes Market" for each patch but what I want is one big "Meat Market" and "Substitutes Market" for each blue square respectively. How can I avoid this?

推荐答案

您只需要求其中一个补丁即可执行此操作.我假设您通过询问具有相应 x 和 y 坐标的补丁将它们的 pcolor 设置为蓝色来分配两个蓝色块?我会要求每个区域中心的两个补丁设置它们的标签,而不是其他.

You'll have to ask just one of the patches to do this. I'm assuming you are assigning the two blue blocks by asking patches with corresponding x and y coordinates to set their pcolor to blue? I'd ask the two patches at the center of each of these areas to set their plabel, and no others.

或者,查看模型库中的模型 El Farol.它以大字体跨补丁写入字母,因此您可以使用其中的代码.

Alternatively, look at the model El Farol in the models library. It writes letters across patches in large font, so you could use the code from that.

这篇关于NetLogo 为补丁块命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 20:13