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

Home » Public Forums » archive » Inverting indices?
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: Inverting indices? [message #2498 is a reply to message #2448] Thu, 07 July 1994 08:57 Go to previous messageGo to previous message
dball is currently offline  dball
Messages: 4
Registered: June 1994
Junior Member
In article <2uslco$m4k@highway.LeidenUniv.nl>, robijn@Strw.LeidenUniv.NL (Frank Robijn) writes:
> In article <kkobayas.772907009@husc9.harvard.edu>,
> Ken Kobayashi <kkobayas@husc9.harvard.edu> wrote:
>>
>> Am I making sense? I just need to do j=OPPOSITE(i,10) so that when
>> i=[1,3,5] it'll return j=[0,2,4,6,7,8,9].
>>
>> I couldn't find a built-in routine that does this. I tried the following
>> code:
>>
>> FUNCTION opposite,idx,n
>> k = bytarr(n)
>> k(idx)=1
>> return,where(not k)
>> end
>>
>> but this didn't seem to work for some reason.
>
> A 'false' value in IDL is -1, not 1. So change k(idx)=1 to k(idx)=-1 and
> it will work.
>
> Frank

Well, to be correct, a 'true' value is any 'odd' value, i.e. LSB is 1.
A 'false' value is any 'even' value, i.e. LSB is 0. The NOT operator
does a bitwise NOT, so this works out. WHERE, however, returns indices
of all *nonzero* elements, so use -1 because (NOT -1) is 0.

-- Dave
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: simultaneous run
Next Topic: Annotating Radar Images

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

Current Time: Wed Oct 08 17:23:33 PDT 2025

Total time taken to generate the page: 0.00455 seconds