Re: Parts of a list
- To: mathgroup at smc.vnet.net
- Subject: [mg15447] Re: Parts of a list
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 18 Jan 1999 04:21:49 -0500
- References: <77jkve$304@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hossein Kazemi wrote in message <77jkve$304 at smc.vnet.net>... >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 Kazem, x={{1,0},{2.5, .5},{3,0},{0,2}}; DeleteCases[x, {_, 0 | 0.0}] {{2.5, 0.5}, {0, 2}} I include the alternative 0.0 to allow for 0.0 as well as the exact 0. Allan. --------------------- Allan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565