Re: select 1st column element based on criteria in 2nd column in mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg124167] Re: select 1st column element based on criteria in 2nd column in mathematica
• From: Fred Simons <f.h.simons at tue.nl>
• Date: Wed, 11 Jan 2012 06:01:25 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Here are two ways:

In[66]:= lst ={{1,3},{2,4},{3,6},{4,1},{5,3},{6,2},{7,5},{8,2}};

In[67]:= Select[lst, #[[2]]>3&][[All,1]]
Out[67]= {2,3,7}

In[68]:= Cases[lst, {x_,y_/;y>3}:>x]
Out[68]= {2,3,7}

Fred Simons
Eindhoven University of Technology

Op 11-1-2012 10:18, Hani schreef:
> hello, I have a question.
>
> Suppose I have a table with two columns like this:
>
> 1  3
> 2  4
> 3  6
> 4  1
> 5  3
> 6  2
> 7  5
> 8  2
>
> I want to select elements of the 1st column which its corresponding 2nd
> column elements are bigger than 3. so, the result should be {2,3,7}.  How to
> implement that in mathematica? Thanx a lot
>
>

```

• Prev by Date: How to create palette buttons with tooltips?
• Next by Date: Re: Unit testing using imported data
• Previous by thread: select 1st column element based on criteria in 2nd column in mathematica
• Next by thread: Re: select 1st column element based on criteria in 2nd column in mathematica