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

Home » Public Forums » archive » Re: array 'minus'
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: array 'minus' [message #36087 is a reply to message #36086] Mon, 18 August 2003 22:12 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Mark Hadfield wrote:

> tomson wrote:
>
>> Hi, I'd like to eliminate some elements in a array. For example,
>> A=[1,2,3,4,5,6,7,8,9,0]
>> N=[3,6]
>> I want to get a array b equal to A but without A(3) and A(6). How to do
>> that?
>
> Well, you could do this:
>
> B = make_array(size(A, /DIMENSIONS), VALUE=1B)
> B[N] = 0B
>
> A = A[where(B)]

Sorry, I didn't read your post very carefully and so gave an answer that
might confuse you. I used "B" for the mask array and saved the trimmed
values back in "A". You wanted the trimmed values in "B". The following
does this. Also it uses the "temporary" finction to delete the mask
array once it's no longer needed.

mask = make_array(size(A, /DIMENSIONS), VALUE=1B)
mask[N] = 0B

B = A[where(temporary(mask))]

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with EOS_GD_INTERPOLATE
Next Topic: IDL authors - get cracking!

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

Current Time: Wed Oct 08 19:25:17 PDT 2025

Total time taken to generate the page: 0.00462 seconds