04-26-2008 05:10 PM - edited 04-26-2008 05:10 PM
04-26-2008 06:20 PM - edited 04-26-2008 06:21 PM
You only attempt to solve part of the problem so far. Checking the range is much more complicated because if a single value is at the limit, the average will be fine, but if all values are near the limit, the sum can overflow or underflow. I am really not sure how much code you want to throw at all this. Maybe it is sufficient to deocument the shortcomings in the help and keep things lean and fast. 😉
For DBL we can use the "mean.vi" from the statistics palette, which apparently (according to the other thread) overflows less and is very similar in speed to a plain SUM/N. It can be used in everything that does it on a 1D array. It even could be used on 2D arrays by e.g. first average colums followed by averaging the remaining 1D array, etc.
EXT is only needed for EXT or I64/U64 inputs. Does anyone know if polymorphic VIs can interact with the "output configuration" (look e.g. at the properties of the multiply node in LabVIEW 8.5). It would be nice to be able to manually specify DBL output even for U64 inputs.
In addition, the function should also work for complex data. Sometimes we want to average vectors! 🙂
04-27-2008 03:45 AM
04-27-2008 11:27 AM - edited 04-27-2008 11:32 AM
Intaris wrote:
maybe you should look closer at the code.....
Intaris wrote:
Even if it is a bit conservative. Using this method, a single large value could force the EXT version without the sum of the array being anywhere close to the real maximum of the DBL type.