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
Inverting indices? [message #2353] Wed, 29 June 1994 09:23 Go to previous message
kkobayas is currently offline  kkobayas
Messages: 7
Registered: June 1994
Junior Member
Hi,

I guess I didn't say it right in the subject, but what I want to do
is, say, for i=[1,3,5] as indeces for a 10-element array, I need to find
the indeces for points NOT set by i, that is, j=[0,2,4,6,7,8,9].

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. The shortest working
routine I could come up with is:

FUNCTION opposite,index,n
k = bytarr(n)
k(*)=1
k(index)=0
return,where(k)
end

I somehow feel there must be a more efficient way of doing this. Can
anyone suggest a better solution? Also, why doesn't the first routine work?





--
------------------------------------------------------------ -----------------
| "Would you tell me, please, which way I
Ken Kobayashi | ought to go from here?"
| "That depends a good deal on where you
kkobayas@husc.harvard.edu | want to get to." - Lewis Carroll
[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 15:34:41 PDT 2025

Total time taken to generate the page: 0.00363 seconds