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

Home » Public Forums » archive » Re: REVERSE even row elements in data array.
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: REVERSE even row elements in data array. [message #12475 is a reply to message #12470] Sun, 02 August 1998 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Henry Throop (throop2@my-dejanews.com) writes in response
to this question by Jouhahn Lee:

>> Would you tell me how can I apply REVERSE only to the even row data in
>> 64*32 array?

> Try this, with your array to be reversed in the array 'data':
>
> xdim = 64 ; x array dimension
> ydim = 32 ; y array dimension
>
> odds = double(((1+intarr(xdim)) # indgen(ydim)) mod 2)
> ; create a list of integers and a list of 1's,
> ; co-multiply them, and extract last bit.
>
> evens = not odds ; every row of this array which is 1 will be
> ; reversed
>
> result = data*odds + reverse(data*evens)
> ; reverse and extract the appropriate elements

This is very nice. But can you elaborate on why you used
the DOUBLE function in the code above? I get the same result
without it and I am wondering what problem you are trying
to solve by using it.

Thanks for this solution.

David

P.S. I solved the problem in a slightly simpler way, like this:

evens = Indgen(32/2) * 2
data[*, evens] = Reverse( data[*, evens] )

--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL limits
Next Topic: Interrupting a widget application

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

Current Time: Sun Oct 12 13:05:07 PDT 2025

Total time taken to generate the page: 0.08198 seconds