I am a new Vensim user and am currently in the "learning by trial and error"
mode.
I am trying to set up a two dimensional array to hold population data that will be read in from an Excel spreadsheet.
My subscripts are AgeCohort and Gender with values (AC1 - AC18) and (Male, Female) respectively.
I've set up the following equation to read the data from Excel:
Population[Gender,AgeCohort] := GET XLS DATA('AllData.xls','Population','4','C5').
However, I get a message stating that "More than one subscript is a subscript range". I've reviewed the subscript portion of the manual and at this point I'm not sure what to try or do next.
Any assistance you could provide would be most appreciated.
Thank you.
John
[Edited on 12-23-2008 by jfolczak]
Two dimensional subscripts
Hi Lee -
I'm sorry for the oversight. I've attached the beginnings of the model. At this point I am simply trying to read data in and pass it to another subscripted variable to ensure I had the subscripts right and the data is read in correctly.
Thanks for your help.
John
I'm sorry for the oversight. I've attached the beginnings of the model. At this point I am simply trying to read data in and pass it to another subscripted variable to ensure I had the subscripts right and the data is read in correctly.
Thanks for your help.
John
- Attachments
-
- AS_Model.mdl
- (1.57 KiB) Downloaded 489 times
Try splitting the eqn for "AS Population" into two parts ('add eq' button in top right fo eqn editor box).
Then try
AS Population[s2,AgeCohort] = GET XLS DATA('C:\!PatientFlow\Work_NSCL_AllData.xls','Population','4','C5')
for the first part and
AS Population[s2,AgeCohort] = GET XLS DATA('C:\!PatientFlow\Work_NSCL_AllData.xls','Population','4','C6')
and this in the second version of the eqn
I'm assuming the data is in rows in Excel since you've specified time in column 4.
Vensim will only continue to look for extra data for the last subscript range dimension of the variable, so you have to explicitly specifiy in the eqns the element of the first subscript range.
Have a look in the help system for the GET XLS DATA Function, there is a nice little example which explains much better than I can
Then try
AS Population[s2,AgeCohort] = GET XLS DATA('C:\!PatientFlow\Work_NSCL_AllData.xls','Population','4','C5')
for the first part and
AS Population[s2,AgeCohort] = GET XLS DATA('C:\!PatientFlow\Work_NSCL_AllData.xls','Population','4','C6')
and this in the second version of the eqn
I'm assuming the data is in rows in Excel since you've specified time in column 4.
Vensim will only continue to look for extra data for the last subscript range dimension of the variable, so you have to explicitly specifiy in the eqns the element of the first subscript range.
Have a look in the help system for the GET XLS DATA Function, there is a nice little example which explains much better than I can