I’ve an external file (.xls) with a forecast prices. I need to upload these data in a way that the model read for every tick the associated value, for example:
at tick 1 the value of the price of 2015,
at tick 2 the value of the price of 2016;
at tick 3 the value of the pice of 2017;
and so on…
I need to install the extensions for Netlogo or there is another way to achieve my purpose?
Tahnk you very much for your attention and for your time.
First, to make the file easy to read, I recommend saving it from Excel as a CSV file. CSV is a very simple, easy to interpret format, and is one the “Common Formats” in the “Save as…” dialog. Next, if possible, try isolating the data in a single column without a header like so:
If that’s not possible, no big deal, but it will make your life easier.
Once you do that, you can use
file-read to read the values out of the file one at a time.
To read it, I’d actually recommend reading the whole thing into a list during setup. Here’s how:
globals [ prices ] to setup ca ... set prices  file-open "/path/to/UPLOAD.csv" ;; or user `user-file` to allow the user to select a file while [ not file-at-end? ] [ set prices lput file-read prices ] file-close ... end
This puts all the values in a list
prices that you can then read from each tick. If you want to read one item per tick, then it’s just
item ticks prices to get the
ticksth item from the list.