[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: drop array elements
Matthew Kay wrote:
>
> Hi,
>
> 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'?
>
> Much thanks,
> Matt
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.
JD
--
J.D. Smith /*\ WORK: (607) 255-6263
Cornell University Dept. of Astronomy \*/ (607) 255-5842
304 Space Sciences Bldg. /*\ FAX: (607) 255-5875
Ithaca, NY 14853 \*/