如何使用 headers 逐行写入或打印多个变量输出到 netlogo 中的命令中心

How to write or print multiple variable outputs with headers, line by line per tick to command center in netlogo

如何使用 headers 将多个变量输出逐行写入或打印到 netlogo 中的命令中心?这个想法是打印出多个变量的滴答结果(由程序报告),以便它出现在命令中心输出中,如下所示 window:

length weight height area 
24.2   23.1   22.0   25.1 
18.7   19.2   10.4   22.0 

依此类推,以柱状形式更新每个报价。

我最终希望能够使用 export-output 命令在模拟结束时将输出传输到 csv 文件 运行。我知道还有其他方法可以做到这一点,但出于某种原因我特别希望这样做。

您需要 typeprint 命令。您的标题需要在初始化过程中打印出来,变量值需要在每次打勾时打印出来。假设您的过程被命名为 cal-length 等,代码看起来像这样。请注意,没有间距控制或其他格式。

to setup
  ...
  print "length   weight   height   area"
  ...
end

to go
  ...
  dump-to-screen
  ...
end

to dump-to-screen
  type calc-length type "   " type calc-weight type "   "
  type calc-height type "   " print calc-area
end