Message 1 of 4
array modification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi,
I have a 2D array of nodes that gets stretched around.
I want to make it so that if it gets stretched to the point that the inter-node distance gets too high it inserts a new row of noses into the middle of the array.
I've been making a new array and putting the second half of the old array into that, then ReDim-ing the first array to be 1 bigger than it was before, then putting the old stuff back into the array and making the new nodes values the average of their neighbours.
There are two problems with this approach though, one is that it doesn't work,(errors abound) and the second is that it's not very elegant!
What I'd really like to be ale to say array.insert, but I think that's a bit beyond vba, so I think the most elegant way to do it would be to copy (split) the contents of the current array into two new ones, delete the old one, and redeclare it, then fill it up from the two temporary arrays.
Does anyone know if this is possible? I can't find anything about deleting arrays in the help files.
I have a 2D array of nodes that gets stretched around.
I want to make it so that if it gets stretched to the point that the inter-node distance gets too high it inserts a new row of noses into the middle of the array.
I've been making a new array and putting the second half of the old array into that, then ReDim-ing the first array to be 1 bigger than it was before, then putting the old stuff back into the array and making the new nodes values the average of their neighbours.
There are two problems with this approach though, one is that it doesn't work,(errors abound) and the second is that it's not very elegant!
What I'd really like to be ale to say array.insert, but I think that's a bit beyond vba, so I think the most elegant way to do it would be to copy (split) the contents of the current array into two new ones, delete the old one, and redeclare it, then fill it up from the two temporary arrays.
Does anyone know if this is possible? I can't find anything about deleting arrays in the help files.