LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract and index every n elements of an array

Hi, 

 

i    x                                          x

0  10                to                   0  10

1  20                                      3  40

2  30                                      6  55

3  40                                      9  70

4  45

5  50

6  55

7  60

8  65

9  70

 

I am trying build a 2D array with the extracted values: one array being the index, and the other is the value of that index shown above.

 

The goal is to extract every n elements (n=3 in this example shown above) out of an array and index the elements and put them in a 2D array. I used the "decimate.vi", and it can extract the element but unable to provide me the index of that element , so does any one know a more efficient solution to program this?  

 

Please help 

 

Thank you

0 Kudos
Message 1 of 6
(3,328 Views)

Here is how I would do it.

 

21115i3F6B167D0E2C5FA8

Tim
GHSP
Message 2 of 6
(3,315 Views)

Thanks for the help. Aeastet, can you please save as the VI in labview 2009, as I am using labview 2009, or show the true case structure screen shot, as I cannot see the true case structure program base on the posted screen shot.

 

Thank you  

0 Kudos
Message 3 of 6
(3,297 Views)

Here you go

 

21143i611014E215FEC2F7

Tim
GHSP
Message 4 of 6
(3,291 Views)

I am a 'decimator' myself.  Only with arrays, not in the Roman sense.

 

DecimateColumns.png

 

 

Message 5 of 6
(3,279 Views)

Your problem is not very well defined, so I make some assumptions.

 

I assume the input array is 1D, and the index is implicit. Here's my solution:

 

 

It would be trivial to adapt to a version with a 2D array input. try it! 🙂

Download All
Message 6 of 6
(3,259 Views)