Page 1 of 1

Subscript and Variables

Posted: Mon Apr 24, 2006 3:49 pm
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

Posted: Mon Apr 24, 2006 9:04 pm
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.

Posted: Tue Apr 25, 2006 8:36 am
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

Posted: Tue Apr 25, 2006 12:32 pm
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]