08-21-2009 01:02 PM
Measures of Mean.vi only takes double precision float as input. When I use single precision to save space, and where A/D resolution is the limiting factor anyhow, it is pretty annoying to have to promote a whole array of data to double just to get the median (or another of the functions in Measures of Mean. Can't this thing be recompiled to be able to do both double and single?
Thanks
08-21-2009 02:26 PM
08-21-2009 03:10 PM
You can easily dump Mean.vi and use Array Sum and divide by Array Length. You could dump Median.vi and use Sort 1D Array and then Interpolate 1D Array with a fractional index of (Array Length - 1)/2. Change the controls to SGL and you should avoid the promotion.
This is easy-to-code version of Median may not work as well as you'd like. Unless the folks at NI did something silly, the code to find the Median probably works in-place (no sorting). The simple method I describe creates a sorted copy, so it not only is a bit slower than it needs to be, it also uses about the same memory since you have two SGL arrays instead of one DBL. You could find a nice algorithm for the median and code it yourself (in LV or C).
My guess is your best bet is to minimize the number of coercions in your code. For example, do everything in DBL until it comes time to write the data to disk. At that point, convert to SGL and save.
08-21-2009 03:46 PM
08-24-2009 08:43 AM