DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to extract a subset of data from a channel at a fixed interval

Hi,

 

I  have a numeric data channel that can be anything up to the max channel length. I need to extract the data value at say every 1000th row and add it as a new row in a seperate channel. Currently I do this by using a for loop and specifiying the interval (1000 in this case) and just copy the value at that row number to the new channel, the interval value is increased by 1000 each time. However this can be very slow when doing for small intervals or repeating it many times for different start values. This is a single channel without an associated time channel.

 

Is there a built in function that I can call that does this and thus benefit from a faster internal loop process

 

Best Regards

 

Keith

0 Kudos
Message 1 of 2
(1,999 Views)

Below is a link showing a complete example from my website of how to re-sample a numeric channel from 17.24 samples/sec to 1/10th that or 1.72 samples/sec, saving the result to a new channel in a new channel group.  It uses the DIAdem command ChnResampleFreqBased().  You can also do the re-sampling manually from the DIAdem analysis panel.  

 

http://www.savvydiademsolutions.com/analysis.php?topic=analysis-resample-channel

 

Another approach would be to read every 1000th value from the data file with the DataFileLoadRed() command, using the "IntervalWidth" option.  

Message 2 of 2
(1,934 Views)