Read in time-dependent array from Excel

Use this forum to post Vensim related questions.
Post Reply
Sandra
Junior Member
Posts: 9
Joined: Mon Aug 29, 2016 12:41 pm
Vensim version: DSS

Read in time-dependent array from Excel

Post by Sandra »

Hi!
I have an Excel sheet containing export streams from one region to another on different time dates (// indicate new column, --- indicate new row).

From// To // 2018// 2019// 2020---
USA// Germany// 0// 10// 20---
USA// China// 10// 20// 30---
USA// USA// 0// 0// 0//
Germany// USA// 5// 10// 20---
Germany// China// 5// 5// 5---
Germany// Germany// 0// 0// 0---
China// USA// 10// 15// 20---
China// Germany// 10// 5// 0---
China// China// 0// 0// 0---


My wish would be that I create a variable in Vensim, that is able to display this array as well. I defined two subscripts:
Subscript 1 (ExportCountries): USA, Germany, China
Subscript 2 (ImportCountries): USA, Germany, China
But I always failed that the variable ExportStream[ExportCountries,ImportCountries] is able to display this time-dependent array in Vensim as well.

Can you please help me how to read in multiple arrays from Excel into Vensim?

Thanks in advance,
Sandra
Attachments
Problem.xlsx
(8.97 KiB) Downloaded 138 times
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Read in time-dependent array from Excel

Post by tomfid »

If you're using GET XLS, it can only handle one dimension (plus time) at a time. So, you'd need three equations to import this:
data[USA,importCountries] = GET XLS DATA( ... , 'C5' )
data[Germany,importCountries] = GET XLS DATA( ... , 'C8' )
data[China,importCountries] = GET XLS DATA( ... , 'C11' )
(Also check the sample model in the Help system, linked to the GET XLS DATA topic.)

For this kind of thing, it may be easier to import the data to a .vdf - you just need to get your input data into an appropriate format - for example:
Problem2.xlsx
(8.48 KiB) Downloaded 154 times
Post Reply