Re: Drop elements from list
- To: mathgroup at smc.vnet.net
- Subject: [mg94191] Re: Drop elements from list
- From: Raffy <raffy at mac.com>
- Date: Sat, 6 Dec 2008 19:57:36 -0500 (EST)
- References: <ghdmqj$flr$1@smc.vnet.net>
On Dec 6, 3:14 am, SigmundV <sigmu... at gmail.com> wrote: > Dear group, > > Consider a list of length, say, 20: > > a = RandomReal[{},20]; > > How would you then drop/delete elements, say, 2-5 and 7-10 from this > list? The built-in function Drop does not seem to include such a > possibility. I should add that I do not have access to Mathematica 7, > so any solution should work in version 6. > > Kind regards, > Sigmund There are many ways to do this; probably the fastest and most flexible method would be: x = Complement[ Range[Length[a]], Range[2,5], Range[7, 10] ]; a[[x]]