Ordered Subscripts

Use this forum to post Vensim related questions.
Post Reply
pochoa
Junior Member
Posts: 8
Joined: Mon Mar 15, 2004 1:54 pm

Ordered Subscripts

Post by pochoa »

I need to order the elements on a vector from smallest to biggest. I know I can use Vector Sort Order for doing it, but after reordening I need to use each of the elements in a different equation and I don't know how to do it, I don't know how to call the first or the third or the last element on the reordered vector.
Thanks for your help.
Administrator
Super Administrator
Posts: 4827
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

The way to do this is to loop through the sorted array.

eg to get element n,

sum (
if then else ( sorted array[subsc!] = n
, sorted array[subsc!]
, 0 )
)

This loops through the array, and will pick out only the element that has the n.

Hope this helps.

Tony.
Post Reply