LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Resizing 'Decimate Array Function'

Solved!
Go to solution

Is there any way to Programmatically resize the 'Decimate 1D Array Function' or another way to do this (hopefully i'm not missing something easy)? I need to decimate a 1D array into "X" number of rows depending on "X" channels that were read in from a file.

 

For example, if I have an 1D array of length 18, and I read in 3 channels I would want a 3x6 array. If I have an 1D array of length 18, and I read in 2 channels I would want a 2x9 array. Any idea on how to tell Labview how many rows I need out of a 1D array?

 

 

It looks like in earlier versions of LabVIEW there was a VI that did what I am looking for. I have tried searching the pallette's and here on the forums as well, but haven't come up with anything that works.

http://forums.ni.com/t5/LabVIEW/Programmatically-Resizing-Decimate-Array/td-p/19880

 

 

Thanks!

-Andrew

0 Kudos
Message 1 of 4
(3,114 Views)

The "Reshape Array" function will probably do what you want. Reshape your 1D array into a 2D array, then index out the desired column or row.

0 Kudos
Message 2 of 4
(3,096 Views)

The reshape array gets the array into the format I can use, but unfortunately it doesn't  sort the data the way I need it to. The reshape array takes "Length" and places it into the first row, the "Second length" goes into the second row and so forth. I need the first element to go into the first row, the second element into the second row, etc. This is how my channels get read in:

 

CH1 Value1

CH2 Value1

CH3 Value1

CH1 Value2

CH2 Value2

CH3 Value2

CH1 Value3

CH2 Value3

CH3 Value3

 

The decimate array did exactly what I needed it to, except I can't change the number of rows /columns if I read in a different number of channels. 

0 Kudos
Message 3 of 4
(3,071 Views)
Solution
Accepted by topic author adekruif

Either swap the dimensions that you feed into the reshape array, or use Transpose Array.  Since I can't tell from the description exactly which way the array is wrong, one or the other of these ideas should fix it.

0 Kudos
Message 4 of 4
(3,057 Views)