MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Drop elements from list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94205] Re: Drop elements from list
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Sun, 7 Dec 2008 05:42:45 -0500 (EST)
  • References: <ghdmqj$flr$1@smc.vnet.net>

On 6 =C4=E5=EA, 13:14, 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

Hello,

In[33]:=
lst = Table[Random[Integer, {1, 10}], {20}]

Out[33]=
{7,8,9,5,3,2,5,10,7,8,4,7,6,6,9,7,8,7,6,9}

In[34]:=
lst[[Flatten[{1, 6, Range[10, 20]}]]]

Out[34]=
{7,2,8,4,7,6,6,9,7,8,7,6,9}


  • Prev by Date: Re: Random Walk model
  • Next by Date: Re: Re: Subscripts in version 7
  • Previous by thread: Re: Drop elements from list
  • Next by thread: Re: Drop elements from list