MathGroup Archive 2001

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

Search the Archive

Re: Q: Extract Elements from a List?


Robert,

Something like this?

In[1]:= list = Range[15, 1, -1]
Out[1]= {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}

In[2]:= start = 5;
        step = 2;

In[3]:= Take[list, {start, Length[list], step}]
Out[3]= {11, 9, 7, 5, 3, 1}


Maarten van der Burgt






Robert Schuerhuber <robert.schuerhuber at gmx.at> on 23-05-2001 07:54:33 AM
cc:
Subject: [mg28976]  [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: Q: Extract Elements from a List?
  • Next by Date: Re: MathGL3D: Keep axis when exporting to VRML ?
  • Previous by thread: RE: Q: Extract Elements from a List?
  • Next by thread: Re: Q: Extract Elements from a List?