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: [mg21359] Re: A better way to decimate a file??
  • From: Tobias Oed <tobias at physics.odu.edu>
  • Date: Wed, 29 Dec 1999 14:15:45 -0500 (EST)
  • Organization: Old Dominion University
  • References: <849j3v$pgm@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Rob Peterson wrote:
> 
> 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

I think this is what you want,

ly=50

y=Table[i,{i,ly}] (* build an example list *)

Map[First,Partition[y,16]]

This will give you elements 1,17 and 33 of y.
Tobias


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