Two dimensional subscripts

Use this forum to post Vensim related questions.
Post Reply
jfolczak
Junior Member
Posts: 8
Joined: Tue Dec 23, 2008 12:33 pm

Two dimensional subscripts

Post 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]
Lee Jones

Post 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
jfolczak
Junior Member
Posts: 8
Joined: Tue Dec 23, 2008 12:33 pm

Post 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
Attachments
AS_Model.mdl
(1.57 KiB) Downloaded 276 times
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Post 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
jfolczak
Junior Member
Posts: 8
Joined: Tue Dec 23, 2008 12:33 pm

Post by jfolczak »

Thank you for your assistance.

I shall try your suggestion now.

John
jfolczak
Junior Member
Posts: 8
Joined: Tue Dec 23, 2008 12:33 pm

Post by jfolczak »

Your suggestion works beautifully.

I appreciate your help.

John
Post Reply