该模型的目的是探索北落基山脉中灰狼的潜在分布模式。在模型中,灰狼被赋予了ph-memory
对应于空间数据表的属性。
extensions [ gis table csv]
wolves-own [
...
ph-memory ;; wolves' patch-hunting memory, table includes the patch's hash-id (KEY) and pack-id (VALUE)
...
]
to initialize-wolf [ new-pack-id ]
...
set ph-memory table:make
...
end
to setup
clear-all
setup-gis
file-open (word "Ph-memory-for-run-" behaviorspace-run-number ".csv")
...
end
to go
if not any? wolves [stop]
ask wolves [
where-am-i
...
file-write (table:to-list ph-memory)
end
to where-am-i
let patch-hash-id ([hash-id] of patch-here) ;;Updates the hash-id of the patch the wolf is currently on
if not table:has-key? ph-memory patch-hash-id
[table:put ph-memory patch-hash-id pack-id]
end
当我打开 Excel 文件查看结果时,整个表格被导出到单个单元格中。不幸的是,这使得数据分析变得毫无意义,因为我不能轻易地操纵数据。
我的问题是:是否可以将数据表结果导出到 excel 中并将数据分解为单个单元格/离散数据对(例如 [patch-hash-id, pack-id])?我开始手动将数据重新格式化为列,但这非常繁琐!
有人建议我如何以有效的方式导出数据?
任何帮助将不胜感激!