Re: Parts of a list
- To: mathgroup at smc.vnet.net
- Subject: [mg15458] Re: [mg15430] Parts of a list
- From: "Arnold Knopfmacher" <arnoldk at gauss.cam.wits.ac.za>
- Date: Mon, 18 Jan 1999 04:22:00 -0500
- Organization: CAM,University ofthe Witwatersrand
- Sender: owner-wri-mathgroup at wolfram.com
Regarding your problem (at end of message), this works In[3]:=
x //.{a___,{b_,0},c___}->{a,c}
Out[3]=
{{2.5,0.5},{0,2}}
Or using Select
In[8]:=
Select[{#},#[[2]]!=0&]& /@x
Out[8]=
{{},{{2.5,0.5}},{},{{0,2}}}
In[9]:=
Flatten[%,1]
Out[9]=
{{2.5,0.5},{0,2}}.
Cheers
Arnold Knopfmacher
> Date: Wed, 13 Jan 1999 20:57:41 -0500
> From: "Hossein Kazemi" <kazemi at som.umass.edu>
To: mathgroup 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}}.