Page 1 of 1

Two dimensional subscripts

Posted: Tue Dec 23, 2008 1:00 pm
by jfolczak
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]

Posted: Tue Dec 23, 2008 4:43 pm
by Lee Jones
Hi John,

if you post the model then someone is more likely to be able to help. Sounds to me like a problem with your subscript definitions but, like I said, difficult to debug without the model.

Lee

Posted: Tue Dec 23, 2008 5:05 pm
by jfolczak
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

Posted: Tue Dec 23, 2008 6:33 pm
by Wilson
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

Posted: Tue Dec 23, 2008 6:52 pm
by jfolczak
Thank you for your assistance.

I shall try your suggestion now.

John

Posted: Tue Dec 23, 2008 6:59 pm
by jfolczak
Your suggestion works beautifully.

I appreciate your help.

John