小编Maí*_*újo的帖子

如何使用netlogo读取.CSV文件?

这些天我开始使用netlogo,所以我遇到了一些我没有找到解决问题的问题.我必须阅读一个巨大的.csv文件,在网上获取此代码:

to openFile
file-open "testeCsv.csv"
set csv file-read-line
set csv word csv ","  ; add comma for loop termination 

let mylist []  ; list of values 
  while [not empty? csv] 
  [
    let $x position "," csv 
    let $item substring csv 0 $x  ; extract item 
    carefully [set $item read-from-string $item][] ; convert if number 
    set mylist lput $item mylist  ; append to list 
    set csv substring csv ($x + 1) length csv  ; remove item and comma 
    set fileList mylist …
Run Code Online (Sandbox Code Playgroud)

csv netlogo

5
推荐指数
2
解决办法
2465
查看次数

标签 统计

csv ×1

netlogo ×1