How can I get a matrix of values into Vensim from a spreadsheet?

Vensim (except PLE) supports the importation of times series data from spreadsheets, but if you are just looking at one time (either for initial conditions or constants) this is not efficient.  To set for, for example, initial population from a spreadsheet, set the spreadsheet up in the form:


initial population[country,male] 1 2 3

initial population[country,female] 2 3 4

Save the spreadsheet as a CSV (comma delimited) file.  The first row, because it contains no values in the first column, is treated as a comment.  Then in the model just enter an equation such as:

initial population[country,sex]=1 ~Person~|

Then enter the CSV file you created from the spreadsheet as a changes file in the simulation control dialog.  Note that it is important to be sure that the order of subscripts in the subscript definition

country: USA,MEX,CAN ~~|

is the same as the order in the spreadsheet.

Posted in: Data IO