MathGroup Archive 1999

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

Search the Archive

Re: Parts of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15440] Re: [mg15430] Parts of a list
  • From: "C. Frey" <Clemens.Frey at uni-bayreuth.de>
  • Date: Mon, 18 Jan 1999 04:21:44 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Hallo, 

for this task you can use both Select and Cases; in the latter case you
have to use a conditional pattern. Just look at the following examples:

x={{1,0},{2.5, .5},{3,0},{0,2}};

Then use

Select[x,#[[2]]!=0&]

or

Cases[x,{_,y_}/;y!=0]

Hope that helped

Clemens

------------------------------------------------------------ 
Clemens Frey
Doctoral Fellow at the 
Department of Mathematics/BITOEK
University of Bayreuth(Germany)

clemens.frey at uni-bayreuth.de
http://www.bitoek.uni-bayreuth.de/~Clemens.Frey
------------------------------------------------------------

On Wed, 13 Jan 1999, Hossein Kazemi wrote:

> I have a list (matrix) that looks like this
> 
> x={{1,0},{2.5, .5},{3,0},{0,2}}
> 
> Now I want to eliminate those vectors that have zero for the second
> case. That is, I want to get
> 
> {{2.5, .5},{0,2}}.
> 
> Is there a quick way of doing this?
> I tried to apply Select to this but could not get it to work.
> 
> Thanks for your help.
> 
> Hossein Kazemi
> UMass
> kazemi at som.umass.edu
> 
> 
> 
> 



  • Prev by Date: Re: Parts of a list
  • Next by Date: Re: InterCall
  • Previous by thread: Re: Parts of a list
  • Next by thread: Re: Parts of a list