MathGroup Archive 1999

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

Search the Archive

Re: A better way to decimate a file??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21353] Re: A better way to decimate a file??
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 29 Dec 1999 14:15:41 -0500 (EST)
  • References: <849j3v$pgm@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Rob,
Two suggestions:

data = Range[100];

Flatten[Partition[data, 1, 16], 1]

{1, 17, 33, 49, 65, 81, 97}

data[[Range[1, Length[data], 16]]]

{1, 17, 33, 49, 65, 81, 97}


Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Rob Peterson" <rob-piovere at swbell.net> wrote in message
news:849j3v$pgm at smc.vnet.net...
> I start with a list y that I need to decimate (sp?).  I've looked thru
> the book and the only list function I can find to dump list elements
> is the Drop[] function.  But, the best I can do is get rid of half of
> the elements at a time.  I want to decimate this list by 16, ie I want
> to dump 15 of every 16 entries.  So, I dump half of them four times.
> This seems to work but I figure the pros hanging in this group will
> know a much more elegant way to do this.  I did this:
>
> (* start with y as the list  and ly = Length[y]  *)
>
> y2 = Drop[y, {1, ly, 2}]; ly2 = Length[y2]
>
> y4 = Drop[y2, {1, ly2, 2}]; ly4 = Length[y4]
>
> and so on
>
> So how should it really be done?  I'd like to be able to decimate by
> non-binary numbers too.
>
> Thanks, Rob
>



  • Prev by Date: Re: Circuit Analyses with Mathematica
  • Next by Date: RE: A better way to decimate a file??
  • Previous by thread: Re: A better way to decimate a file??
  • Next by thread: RE: A better way to decimate a file??