comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » array handling
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: array handling [message #74242 is a reply to message #74188] Wed, 05 January 2011 07:07 Go to previous messageGo to previous message
MC is currently offline  MC
Messages: 50
Registered: September 1996
Member
On Jan 4, 7:16 am, David Fanning <n...@dfanning.com> wrote:
> bing999 writes:
>> Thanks for answering. But what I want is to divide the number of
>> elements of my array by 2 by keeping only elements with odd index for
>> instance. Is there an IDL routine which does it?
>
> IDL> array = indgen(10)
> IDL> print, array
>  0       1       2       3       4       5       6       7       8     9
> IDL> print, rebin(array, 5)
>        0       2       4       6       8
>
> Cheers,
>
> David
>

Err, isn't that's going to average the data without the /sample
keyword? As an alternative, how about about using reform:

IDL> array = indgen(10)
IDL> evenodd=reform(array,2,5)
IDL> print,"even:" & print,evenodd(0,*)
IDL> print,"odd:" & print,evenodd(1,*)

As one line:
print,(reform(array,2,5))(1,*)

Cheers MC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: stl files
Next Topic: IDL output directed to STDERR-- can't seem to work around...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 08:59:52 PDT 2025

Total time taken to generate the page: 1.36125 seconds