MathGroup Archive 2001

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

Search the Archive

RE: Q: Extract Elements from a List?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28975] RE: [mg28968] Q: Extract Elements from a List?
  • From: Mikael Adlers <mikael at mathcore.com>
  • Date: Thu, 24 May 2001 04:06:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
just use the function Take. Info from the help:

 Take[list, {m, n, s}] gives elements m through n in steps of s. 

Thus something like this should do it,

list={a,b,c,d,e,f,g,h,i,j}
start=3;
step=2;
Take[list, {start, Length[list], step}]

Regards,
/Mikael Adlers

------------------------------------------------------------------ 
 Mikael Adlers, Ph.D.          email: mikael at mathcore.com 
 MathCore AB                   phone: +4613 32 85 07 
 Wallenbergsgata 4             fax:         21 27 01
 SE-583 35 Linkoping, Sweden                   



> -----Original Message-----
> From: Robert Schuerhuber [mailto:robert.schuerhuber at gmx.at] 
To: mathgroup at smc.vnet.net
> Sent: den 23 maj 2001 07:55
> To: mathgroup at smc.vnet.net
> Subject: [mg28975] [mg28968] Q: Extract Elements from a List?
> 
> 
> hi!
> 
> probably a very easy question, but i couldn't find an answer in the
> mathematica-book:
> 
> i need to extract elements from a list, starting th element 
> number x and than taking every yth element, eg:
> 
> with
> 
> list={a,b,c,d,e,f,g,h,i,j}
> start=3;
> step=2:
> 
> i'd like to get the list
> 
> {c,e,g,i}.
> 
> how can i do this in the easiest way?
> 
> regards, robert
> 
> 


  • Prev by Date: Re: Can Mathematica draw overlapping shapes with blended color?
  • Next by Date: Re: OOP in Mathematica
  • Previous by thread: Re: Q: Extract Elements from a List?
  • Next by thread: RE: Q: Extract Elements from a List?