MathGroup Archive 1999

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

Search the Archive

Re: Parts of a list

  • To: mathgroup at
  • Subject: [mg15478] Re: Parts of a list
  • From: Stephen P Luttrell <luttrell at>
  • Date: Mon, 18 Jan 1999 04:22:20 -0500
  • Organization: Defence Evaluation and Research Agency
  • References: <77jkve$>
  • Sender: owner-wri-mathgroup at

>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.

This does the trick:

In[1]:=Cases[{{1,0},{2.5, .5},{3,0},{0,2}},{_,_?(#!=0&)}]


Stephen P Luttrell
Signal Processing and Imagery Department DERA Malvern, St.Andrew's Road
Malvern, United Kingdom, WR14 3PS

+44 (0)1684 894046 (tel)
+44 (0)1684 894384 (fax)
luttrell at (email)

  • Prev by Date: Re: typing starting values in FindMinimum
  • Next by Date: Re: getting the name of a symbol
  • Previous by thread: Re: Parts of a list
  • Next by thread: Helmholtz equation