Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: select 1st column element based on criteria in 2nd AND 3rd column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124517] Re: select 1st column element based on criteria in 2nd AND 3rd column
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Sun, 22 Jan 2012 07:25:00 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jfe3q1$a2i$1@smc.vnet.net>

On Sat, 21 Jan 2012 10:25:05 -0000, hanciong awesome <hanciong at gmail.com>  
wrote:

> Hello all, suppose I have a table:
>
> pairs = {{1, 3, 4}, {2, 4, 6}, {3, 6, 7}, {4, 1, 8}, {5, 3, 9}, {6, 2,
>     10}, {7, 5, 11}, {8, 2, 13}, {2, 3, 4}, {5, 6, 7}}
>
> how to select rows for which the 2nd column is between 3 and 5, AND
> the 3rd column is between 7 and 10? So I want to do something similar
> to this:
>
> Select[pairs, 5 >= #[[2]] >= 3 &  AND  10 >= #[[3]] >= 7]
>
> but I just couldn't get it to work. what should I do? Thank you
>

In := Select[pairs, 5 >= #[[2]] >= 3 && 10 >= #[[3]] >= 7 &]

Out = {{5, 3, 9}}

Here the fact that AND remains in blue and the second # (Slot) in pink  
should be taken as a hint that your example is not written correctly.



  • Prev by Date: Re: using units with FindRoot
  • Next by Date: Re: select 1st column element based on criteria in 2nd AND 3rd column
  • Previous by thread: Re: select 1st column element based on criteria in 2nd AND 3rd column
  • Next by thread: Re: select 1st column element based on criteria in 2nd AND 3rd column