Change a specific element of an array
Posted: Wed Feb 20, 2013 6:00 pm
Hi,
I am trying to select and change only one element of an array which satisfies a certain condition even if there are several elements within this array which satisfy that condition. For example, I have the following array v=(-1,-1,0,0,0) in which two elements equal -1 (the condition). However, I only want to change one of the two elements which equal -1 to zero and leave the other unchanged (i.e., v'=(0,-1,0,0,0) or (-1,0,0,0,0)). How can I do this in Vensim?
Thanks a lot!
I am trying to select and change only one element of an array which satisfies a certain condition even if there are several elements within this array which satisfy that condition. For example, I have the following array v=(-1,-1,0,0,0) in which two elements equal -1 (the condition). However, I only want to change one of the two elements which equal -1 to zero and leave the other unchanged (i.e., v'=(0,-1,0,0,0) or (-1,0,0,0,0)). How can I do this in Vensim?
Thanks a lot!