Migrating values w/in an array (or to another if necessary!)
Posted: Wed Aug 05, 2015 9:14 pm
Hello,
I have a variable that stores the position of objects in a series of subareas, e.g.:
Object Position by SubArea[SubArea,ObjectID]
Currently SubArea has 3 elements: SA1, SA2, SA3
ObjectID has 60 elements: O1, O2, etc
I am trying to merge the three subareas into a single geographic area so I instead have the variable: Object Position[ObjectID]
The matrix is sparsely populated (always less than 5 objects in each subarea) and the ObjectIDs are re-used at the start of a new subarea. In other words, if there's 2 objects in SubArea 1, 2 objects in SubArea2, and 1 object in SubArea3, then the values for Object Position by SubArea[SubArea,ObjectID] might be:
[SA1,O1]: 14
[SA1,O2]: 17
[SA2,O1]: 37
[SA2,O2]: 50
[SA3,O1]: 67
(a zero is stored for any combinations of subarea and objectID with no position data)
what I would like to do is:
-retain the current value of Object Position by SubArea[SubArea,ObjectID] in the new Object Position[ObjectID] variable, if the SubArea is SA1
-if the SubArea is SA2, store the values for O1, O2, etc in O21, O22, etc (i.e. offset the location of the value by 20)
-if the SubArea is SA3, store the values for O1, O2, etc in O41, O42, etc (offset the location of the value by 40)
I've created an Object ID Number[ObjectID] variable, a SubArea ID Number[SubArea] variable, and a alternative array called "EntityID" which is the same size as "ObjectID", and tried all kinds of combinations of VECTOR functions, subranges, etc... but can't get the result I'm looking for. Is there any way to get there from here?
thank you!
Buzz
I have a variable that stores the position of objects in a series of subareas, e.g.:
Object Position by SubArea[SubArea,ObjectID]
Currently SubArea has 3 elements: SA1, SA2, SA3
ObjectID has 60 elements: O1, O2, etc
I am trying to merge the three subareas into a single geographic area so I instead have the variable: Object Position[ObjectID]
The matrix is sparsely populated (always less than 5 objects in each subarea) and the ObjectIDs are re-used at the start of a new subarea. In other words, if there's 2 objects in SubArea 1, 2 objects in SubArea2, and 1 object in SubArea3, then the values for Object Position by SubArea[SubArea,ObjectID] might be:
[SA1,O1]: 14
[SA1,O2]: 17
[SA2,O1]: 37
[SA2,O2]: 50
[SA3,O1]: 67
(a zero is stored for any combinations of subarea and objectID with no position data)
what I would like to do is:
-retain the current value of Object Position by SubArea[SubArea,ObjectID] in the new Object Position[ObjectID] variable, if the SubArea is SA1
-if the SubArea is SA2, store the values for O1, O2, etc in O21, O22, etc (i.e. offset the location of the value by 20)
-if the SubArea is SA3, store the values for O1, O2, etc in O41, O42, etc (offset the location of the value by 40)
I've created an Object ID Number[ObjectID] variable, a SubArea ID Number[SubArea] variable, and a alternative array called "EntityID" which is the same size as "ObjectID", and tried all kinds of combinations of VECTOR functions, subranges, etc... but can't get the result I'm looking for. Is there any way to get there from here?
thank you!
Buzz