Re: Segregating the elements of a list based on given lower and

*To*: mathgroup at smc.vnet.net*Subject*: [mg77384] Re: Segregating the elements of a list based on given lower and*From*: Donald DuBois <donabc at comcast.net>*Date*: Thu, 7 Jun 2007 04:05:38 -0400 (EDT)*Organization*: The Math Forum

values = {6.32553, 7.09956, 8.56784, 16.1871, 15.3989, 17.2285, 7.40711, 14.8876, 19.9068, 10.0834}; intervals = {{0, 7}, {8, 10}, {11, 12}, {13, 15}, {16, 18}}; This will give you a list of the values that fall into each of the intervals: res = Map[BinLists[values, {#}] &, intervals] {{{6.32553}}, {{8.56784}}, {{}}, {{14.8876}}, {{16.1871, 17.2285}}} (Not all values fall into an interval and one interval has no values.) In order to tally the number of values in each of the intervals Flatten the above result by one level and Map Length over it: Map[Length[#] &, Flatten[res, 1]] which gives the number of values that fall into each of the intervals: {1, 1, 0, 1, 2} (This assumes the BinList that comes with Ver. 6 - not sure about previous versions of BinList) Regards, Don DuBois