Subscript and Variables

Use this forum to post Vensim related questions.
Post Reply
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Subscript and Variables

Post by nikvyas »

Hi there.

I'm new to Vensim so I'm wondering if somebody could assist me wrt Subscripts. I've defined a subscript and placed a Box Variable in which I want to define the elements of the subscript as other Variables- i.e., I want the elements of the subscript to be variables - is this possible? I've tried doing this, but I keep getting error messages.

Previously, I've defined the subscript by constants - i.e., 1,2,3,4,5 which is fine but I can't define it as var1,var2,var3,var4,var5

Thanks for your help.

Nik
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

It is not clear exactly what you are trying to accomplish but subscripts can only be defined symbolically and their elements can't be anything but that - subscript elements. There is a chapter in the User's Guide on subscripts that might be helpful in understanding how they work.
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Post by nikvyas »

Thanks Bob.

All I really want to do is to combine five variables onto one graph. I therefore thought that if I created a subscript called 'lines', I could make the five variables, elements of the graph - i.e, the equation would read:

graph[lines]=var1,var2,var3,var4,var5

Thanks.

Nik
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Now I understand. You will need to write

graph[line1]=var1~~|
graph[line2]=var2~~|
graph[line3]=var3~~|

And so on (use the Add Eq button in the equation editor). Of course it may be easier to just make a custom graph.

[Edited on 2006-4-25 by bob@vensim.com]
Post Reply