LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need to decimate an array by a variable amount

I'm working with a large waveform that I'm sending to a d/a card with a max frequency of around 125kHz. I'd like to decimate this array by an amount determined by the array size and period over which it will be output. I know I can decimate by a fixed value using the decimate vi, but I'd like something variable.

I've looked at putting the index array function in a loop, where N is determined by the array size. I look at the degree of decimation desired and if the division of that by the loop index is zero, I'd like to add that value to a new smaller array. Problem is I tried using the =0 function to input into the select (?TF) function. If true, I'd like to pass the array value out, if not, I'd lik
e to do nothing. Unfortunately, something has to be wired to the F input of the select function. I'd end up with an array the same size, with the values I wanted to discard being equal to some constant (for example).

Does anybody have a vi which can decimate an array by a variable amount, or any hints on how I should proceed? Thanks for your time.
Message 1 of 3
(2,680 Views)
You can use a shift register initialized as empty, and use a case structure, in true case, you can add your value, and in false case pass the value unchanged.
Hope this helps
0 Kudos
Message 2 of 3
(2,680 Views)
The vi attached to this message may help you. It is written in LabVIEW 5.

You select the starting index and the decimation number. The vi check that the starting point is within range and that the array is not empty. If one of these happens, it returns and empty array.

I haven't test this vi rigurously, so use it at your own risk. Also, it accept double precision numbers. It will be better if it can be converted to a polymorphic vi.

Best regards;
EJV
www.vartortech.com
Message 3 of 3
(2,680 Views)