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: [mg21362] RE: [mg21350] A better way to decimate a file??
  • From: "Harvey P. Dale" <hpd1 at is2.nyu.edu>
  • Date: Wed, 29 Dec 1999 14:15:48 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Rob:
	You can Drop as many elements in the list (or, conversely, Take as
many elements in the list) as you'd like in one command.  I don't know
whether you want to keep every 16th element, or simply want to remove
15/16ths of the elements (even if those removed are consecutive).  If the
latter, this is an example which would leave you with the first
(approximately) 1/16th of the list:
Take[y,{1,Floor[ly/16]}]
If the former, here's one way to do it:
Transpose[Partition[l,16]][[1]]
	Good luck.
	Harvey

 -----Original Message-----
From: 	rob-piovere at swbell.net [mailto:rob-piovere at swbell.net] 
To: mathgroup at smc.vnet.net
Sent:	Tuesday, December 28, 1999 12:50 AM
To:	mathgroup at smc.vnet.net
Subject:	[mg21350] A better way to decimate a file??

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: A better way to decimate a file??
  • 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??