01-12-2016 01:40 AM
I have an array of intergers and I want to find the most commonly occurring element in the array. I thought this was the definition of Mode in statistics. however, the mode funciton returns a floating point value. If I have an array with 19 elements, 17 are 50 and two are 150, the mode funciton gives me 50.25 as the result. I would have expected the result to be 50. I don't mind writing my own funciton, but what is the native statistics function doing here?
01-12-2016 01:49 AM
01-12-2016 03:38 AM
Hi Gerd:
I gave my example already, didn't I. I'm asking about what mode means. I was taught it means most commonly occurring value value. It's a counting function. I see that it is not implemented this way in LabVIEW, but then I'm not clear on what LabVIEW's mode function is.
01-12-2016 03:58 AM
01-12-2016 02:49 PM
littlesphaeroid,
The Mode VI has an input called Intervals, which specifies the number of histograms it uses in the algorithm and then returns an estimated mode. If you want this function to return the exact mode, then set Intervals to 0. You should then see a result of 50 instead of 50.25 for example.
01-12-2016 02:58 PM
Others have said it already, but here is the linked help on that function.
http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/mode/
This help is instealled with LabVIEW. Open the Context Help (CTRL+H) in LabVIEW and hover over this function. In the help window there is a button for detailed help that has this same information.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-12-2016 08:13 PM
Thank you elcalverado! This makes sense and now I understand. I was not aware that mode could mean anything else! Your response was helpful.