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

Home » Public Forums » archive » Re: drop array elements
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: drop array elements [message #21464 is a reply to message #21461] Fri, 25 August 2000 00:00 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"J.D. Smith" wrote:
>
> Matthew Kay wrote:
>>
>> Would anyone have any suggestions for an easy way
>> to drop elements in an array? For example, say 'a'
>> is a 14x1024 array and 'b' is a 1x25 array of row
>> indicies in 'a' that should be dropped. Is there
>> a simple command for re-assigning 'a', without the
>> 25 rows indicated in 'b'?
>>
> a=a[*,where(histogram(b,MIN=0,MAX=(size(a,/DIMENSIONS))[1]-1 ,BINSIZE=1) eq 0)]
>
> The real meat here is finding a list of indices which do not contain the
> elements of b. There are many ways to do this, but this is a fast one.

I just *had* to understand this one. Here's another way of implementing
this method:

;- Get number of rows in a
dims = (size(a, /dimensions))[1]

;- Create index array for rows of a (1=keep the row, 0=discard the row)
index = replicate(1L, nrows)
index[b] = 0L

;- Locate the indices of rows we wish to keep
keep = where(index eq 1)

;- Extract the rows we wish to keep
a = (temporary(a))[*, keep]

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: PV-WAVE Runtime Mode Balks
Next Topic: PV-WAVE Runtime Mode Balks

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

Current Time: Sat Oct 11 14:54:24 PDT 2025

Total time taken to generate the page: 0.48179 seconds