|
From: Christopher B. <Chr...@no...> - 2010-02-10 18:28:13
|
Oz Nahum wrote:
> Here's a quick and dirty solution how to sample every nth element in a
> vector - there's probably a faster way, with out loops,
there sure is:
In [8]: orig
Out[8]:
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19])
In [9]: orig[0:-1:4] # every 4th element
Out[9]: array([ 0, 4, 8, 12, 16])
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|