Showing results for 
Search instead for 
Did you mean: 

Error in Mean PtByPt VI

@B.Settles wrote:

In making my own version, I did find another "error" in that the size needed to be reset to 0 also, which would give the NaN. 


So my desire was to use the Init as a reset and ignore whatever the input value was (if I'm resetting, the value is invalid/garbage in my use case and there could be multiple resets in a row). Seeing as I'm on an island on this one, I'll move on with my own version. Simplify... Make an init, and an execute. Functional globals have there use, but any VI that has more then one function is more complex then it needs to be. Even an init and normal use in the same VI make the VI more complex then it needs to be.


Then you have the problem with scaling up, that not a lot of people seem to share. Both reentrant PtByPt VI's as functional globals do not scale up very well. When everything is in a (class) wire, you can always simply copy the code, and get two implementations, or (preferred) make composite classes and the entire code will be unchanged, except everything is done n times.


As a *big* bonus, you get the ability to switch between algorithms. For instance you now need a mean. At some point you might want a median, a linear fit, a polynomial calibration, whatever. If the mean is a child class of a filter parent, you can switch without changing anything except the init of the filter. A composite filter child allows you to do a fit on the mean, or a mean after calibration. The sky is the limit.


This might seem terrible complicated. It's really not. It's basic OO, and very easy to get used to.


0 Kudos
Message 11 of 11