NetLogo可以读取Excel文件格式吗? [英] Can NetLogo Read an Excel File Format?

查看:301
本文介绍了NetLogo可以读取Excel文件格式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用单个数据列表来更新ABM中的变量.不幸的是,由于我现在正在使用的数据量很大,因此先构建列表然后再构建表变得越来越耗时.这些表的数据经常更改,因此不仅是一次性的事情.

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.

我希望获得一些方法来创建可直接从excel电子表格中读取的表格,而无需花费时间通过输入单个列表来显式地建立表格?我的表包含一个键列表(超过1000个键的列表)和将近100个与每个键对应的变量,在调用键时必须对其进行更新.数据是从其他模型(不是ABM)生成的,并生成具有(X值)和(Y值)的excel电子表格.像这样:

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

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

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

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

…..

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

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

如果有人有更快的方法从excel到NetLogo表中获取大量数据,我将不胜感激.

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

推荐答案

两种解决方案,假设您不想编写扩展名.您可以将Excel文件另存为CSV,然后

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

  1. 编写一个NetLogo程序来读取您的CSV文件.要开始使用,请参见 http://netlogoabm.blogspot.com/2014/01/reading-from-csv-file.html

  1. 使用脚本语言(建议使用Python)读取CSV文件,然后写出
  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

这篇关于NetLogo可以读取Excel文件格式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆