Re: Q: Extract Elements from a List?
- To: mathgroup at smc.vnet.net
- Subject: [mg28978] Re: [mg28968] Q: Extract Elements from a List?
- From: Anesh Sooklal <anesh at fermi.udw.ac.za>
- Date: Thu, 24 May 2001 04:06:55 -0400 (EDT)
- References: <200105230554.BAA01361@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Robert, Here is a quick solution test = {a, b, c, d, e, f, g, h, i, j} h[a_, d_] := Table[Part[test, n], {n, a, Part[Dimensions[test], 1], d}] Here a function is designed to give you the list output you desire. Here a is the first element to be extracted and d is the step size through the list thereafter. Let me know how this turns out!! Thank you, Anesh 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
- References:
- Q: Extract Elements from a List?
- From: Robert Schuerhuber <robert.schuerhuber@gmx.at>
- Q: Extract Elements from a List?