LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling a large array of integers

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 4
(2,887 Views)
Solution
Accepted by topic author rinscneutrons

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 

Message 2 of 4
(2,884 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 4
(2,882 Views)

That did the trick.

Thanks,

Steve

 

 

0 Kudos
Message 4 of 4
(2,848 Views)