MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: On partitioning lists by intervals


On 21 Aug 2007, at 11:03, Mauricio Esteban Cuak wrote:

> Hello there.
> I'm just starting in mathematica and I realise this is a very basic
> question, but I tried to find an answer on the documentation center
> for a couple of hours and on the archive for mathgroup, but couldn't
> find it.
> I have a list of say 500 different random values. I need to divide it
> in n intervals of fixed length (for example, the lowest value is 0 and
> the maximum 100 so I need to get sublists of values that go from 0 to
> 10, 10 to 20, etc.)
> Thanks for your help!
>
> cd
>


Using Mathematica 6.0:

ls = RandomInteger[{0, 100}, {30}]
{51, 75, 6, 78, 43, 80, 9, 12, 65, 10, 26, 71, 49, 53, 39, 67, 98,  
62, 12, \
43, 70, 38, 51, 13, 45, 75, 52, 0, 70, 77}

BinLists[ls, 10]
{{}, {6, 9, 0}, {12, 10, 12, 13}, {26}, {39, 38}, {43, 49, 43, 45},  
{51, 53,
   51, 52}, {65, 67, 62}, {75, 78, 71, 70, 75, 70, 77}, {80}, {98}}


Andrzej Kozlowski


  • Prev by Date: FWHM, InterpolationFunction & Solve
  • Next by Date: Re: Intensive numerical calculations
  • Previous by thread: On partitioning lists by intervals
  • Next by thread: RE: On partitioning lists by intervals