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: [mg28988] Re: Q: Extract Elements from a List?
  • From: Ignacio Rodriguez <ignacio at sgirmn.pluri.ucm.es>
  • Date: Thu, 24 May 2001 04:07:05 -0400 (EDT)
  • Organization: UCM
  • References: <9efk6g$1d8@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There are many ways, but you can try the following:

Module[{i},Table[Part[list,start+step i],{i,0,(Length[list]-start)/step}]]

Robert Schuerhuber wrote:

> 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

--

Ignacio Rodriguez Ramirez de Arellano
Unidad de RMN
Universidad Complutense
Paseo Juan XXIII, 1
Madrid 28040, Spain

Tel. 34-91-394-3288
Fax  34-91-394-3245
e-mail: ignacio at sgirmn.pluri.ucm.es





  • Prev by Date: RE: Q: Extract Elements from a List?
  • Next by Date: A tricky equation
  • Previous by thread: Re: Q: Extract Elements from a List?
  • Next by thread: RE: Q: Extract Elements from a List?