Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: On partitioning lists by intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80438] Re: [mg80396] On partitioning lists by intervals
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 22 Aug 2007 04:50:17 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

data = RandomInteger[{0, 100}, 500];

p1 = Table[Select[data, 10*n <= # < 10*(n + 1) &], {n, 0, 10}];

p2 = Table[Cases[data, _?(10*n <= # < 10*(n + 1) &)], {n, 0, 10}];

p3 = BinLists[data, {0, 110, 10}];

p1 == p2 == p3

True


Bob Hanlon

---- Mauricio Esteban Cuak <cuak2000 at gmail.com> 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
> 



  • Prev by Date: Re: Best practise for defining shortened display versions of custom
  • Next by Date: Re: On partitioning lists by intervals
  • Previous by thread: RE: On partitioning lists by intervals
  • Next by thread: Re: On partitioning lists by intervals