mode of a wave?
Thu, 09/26/2019 - 05:23 am
I have a number of files that sometimes have varying amounts of data points, I would like to see what is the most common number of points.
I have a function that finds the numpnts() of the loaded waves and puts the numpnts in another wave. My current solution to find the mode is:
wave loadedpnts = root:loadedpnts
//find maximum number in loaded pnts
//make a wave for histogram output and call histogram function
Histogram/B=(0,1,v_max+1) loadedpnts, loadedpnts_hist
//check for maxloc in histogram output
variable loadedpnts_max = v_maxrowloc
this will obviously fail if there are equal numbers of waves loaded with 2 or more different points (e.g. 2 waves loaded with 500 points and 2 waves loaded with 450 points).
So 2 questions:
1) is there a better way to do this?
2) is there a way around the problem of non-unimodal points?