LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to select even values in an array

If I want to only use the even indexed values in an array, say the values in 2,4,6,8, ..., what's the easiest way to do it? Thanks!
0 Kudos
Message 1 of 3
(3,250 Views)

Look at Decimate 1D Array...

 

 

 

 

 

Message Edited by Phillip Brooks on 10-24-2008 02:25 PM
0 Kudos
Message 2 of 3
(3,248 Views)

It may depend on how you want to use them.

 

To get an array with only the even numbered indices from the original array, use  the decimate array function set for two arrays.  One array will have all the odd numbered indices and the other all the even numbered indices.

 

Or, use autoindexing on a loop.  Inside: a case structure selected by the Remainder output from the Quotient and Remainder function.  Divide "i" by 2.  The "0" case is for even indices and the "1" case is for odd indices.

 

Probably other ways, too.

 

Lynn 

0 Kudos
Message 3 of 3
(3,244 Views)