RE: List Question
- To: mathgroup at smc.vnet.net
- Subject: [mg67927] RE: [mg67889] List Question
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Thu, 13 Jul 2006 06:53:32 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Simon,
> I have a list with the following structure:
>
> {{x1,y1},{x2,y2},{x3,y3,z3},{x4,y4}...}
>
> As you can see some of the data points have three elements. I
> would like to remove these z elements so that the list has a
> structure {{x1,y1},{x2,y2},{x3,y3},{x4,y4}...}. I'm not sure
> how to achieve this so any help is greatly appreciated.
If
lst = {{x1, y1}, {x2, y2}, {x3, y3, z3}, {x4, y4}}
Then there is always
new = lst /. {x_, y_, z_} -> {x, y}
Regards,
Dave.