MathGroup Archive 1999

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

Search the Archive

Re: Parts of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15463] Re: Parts of a list
  • From: Harald Giese <giese at dkrz.de>
  • Date: Mon, 18 Jan 1999 04:22:07 -0500
  • Organization: Institut fuer Meereskunde, Universitaet Hamburg
  • References: <77jkve$304@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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

Hi Hossein,

Use the function "Select", in your case:

Select[x, (#[[2]] != 0.)&]

Regards,
Harald


-- 
Harald Giese
Email: giese at dkrz.de
Phone: +49 (0)40 4123 5796; Fax: +49 (0)40 5605724 Institut fuer
Meereskunde der Universitaet Hamburg (Institute of Oceanography of the
University of Hamburg) Troplowitzstrasse 7, D-22529 Hamburg


  • 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: Re: Parts of a list