Mathematica 9 is now available
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: Segregating the elements of a list based on given lower and

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77300] Re: Segregating the elements of a list based on given lower and
  • From: chuck009 <dmilioto at comcast.com>
  • Date: Wed, 6 Jun 2007 07:22:13 -0400 (EDT)

This is what I'd do:

A = {6.32553, 7.09956, 8.56784, 16.1871, 15.3989, 17.2285, 7.40711, 14.8876, \
19.9068, 10.0834}

B = {{0, 7}, {8, 10}, {11, 12}, {13, 15}, {16, 18}}

In[43]:=
nlist=Table[Select[A,(# >= B[[i,1]] && # <= B[[i,2]])&],{i,1,Length[B]}]

Length /@ nlist

Out[43]=
{{6.32553},{8.56784},{},{14.8876},{16.1871,17.2285}}

Out[44]=
{1,1,0,1,2}


  • Prev by Date: Re: A wrong definite integral in 5.0?
  • Next by Date: Re: Anyone used the Notation package in v6 already?
  • Previous by thread: Re: question
  • Next by thread: Re: Segregating the elements of a list based on given lower and