03-25-2009 12:57 PM
Hi,
I have a 1-d array with upwards of 1 million elements. I need to "pull out" every other element and put it in a new array.
Right now I have a "for" loop that divides the index of the loop by 2. If there is no remainder it ignores that index. If there is a remainder it indexes the array at that element and puts the element into a new array.
After ~300,000 elements the program slows down considerably.
Any suggestions?
Thanks,
Steve
Solved! Go to Solution.
03-25-2009 01:06 PM
Try the Decimate Array primitive. Use it with two output arrays (default - it is expandable) and do not connect the one you do not need to use.
Lynn
03-25-2009 01:14 PM
THe slow down is probably due the build array repeatedly allocating memory.
Try Lynn's suggestion since it accomlishes he same thing but with a sinlge operation.
Ben
03-25-2009 04:47 PM
That did the trick.
Thanks,
Steve