Can NetLogo Read an Excel File Format?

匆匆过客 提交于 2020-01-16 04:21:11

问题


I've been using individual lists of data to update variables in my ABM. Unfortunately due to the size of data I am using now, it is becoming time consuming to build the lists and then tables. The data for these tables changes frequently, so it is not just a one time thing.

I am hoping to gain some ideas for a method to create a table that can be read directly from an excel spreadsheet, without going through the time to build the table explicitly by inputing the individual lists? My table includes one list of keys ( a list of over 1000 keys) and nearly a hundred variables corresponding to each key, that must be updated when the key is called. The data is produced from a different model (not an ABM) and produces an excel spreadsheet with Keys (X values) and Values (Y values). Something like:

X1 Y1,1 Y1,2 Y1,3… Y1,100

X2 Y2,1 Y2,2 Y2,3… Y2,100

…..

X1000 Y1000,1 Y1000,2 Y1000,3…. Y1000,100

If anyone has a faster method for getting large amounts data from excel into a NetLogo table, I would be very appreciative.


回答1:


Two solutions, assuming you do not want to write an extension. You can save the Excel file as CSV and then

  1. write a NetLogo procedure to read your CSV file. To get started, see http://netlogoabm.blogspot.com/2014/01/reading-from-csv-file.html

or

  1. use a scripting language (Python recommended) to read the CSV file and then write out a .nls file with code for creating the table


来源:https://stackoverflow.com/questions/27059067/can-netlogo-read-an-excel-file-format

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!