Re: List Question
- To: mathgroup at smc.vnet.net
- Subject: [mg67938] Re: [mg67889] List Question
- From: "Carl K. Woll" <carl at woll2woll.com>
- Date: Thu, 13 Jul 2006 06:54:03 -0400 (EDT)
- References: <200607120905.FAA22137@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Simon Bale wrote: > Hi, > > 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. > > Regards, Simon Bale. Here are two reasonbly simple methods: data = {{x1,y1},{x2,y2},{x3,y3,z3},{x4,y4}}; Take[data, All, 2] or data[[All,{1,2}]] will both yields your desired result. Carl Woll Wolfram Research
- References:
- List Question
- From: "Simon Bale" <simonjbale@gmail.com>
- List Question