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

Home » Public Forums » archive » loop for where command
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
loop for where command [message #43038] Wed, 09 March 2005 14:57 Go to next message
aswatantran is currently offline  aswatantran
Messages: 3
Registered: March 2005
Junior Member
i have an array eg. polygonids[1,1,2,2,3,3,3,4,5,5,5,6,6,7,7,8,8,9,10].
i want to extract all the subscripts which have the same value into
separate arrays

i tried it with the where command in a loop but it doesnt seem to work
because the array has varying dimensions and i would need to create it
at runtime

does anybody have any suggestions on how this can be done

thanks
Anu
Re: loop for where command [message #43185 is a reply to message #43038] Thu, 17 March 2005 11:45 Go to previous message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
anu wrote:
> hi
>
> thanks for the tip .. it works !!
> but i am not able to extract the data further into separate arrays
>

Well, say a is your original array and you could extract all indices of
ones (1's) into the variable "ones_indices" then you can extract them
into a separate array by

ones_array = a[ones_indices]

Of course, if you know that you have "count" ones in your array, this is
equivalent to

ones_array = replicate(1, count)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: loop for where command
Next Topic: Re: changing array dimensions

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

Current Time: Fri Oct 10 05:02:21 PDT 2025

Total time taken to generate the page: 0.16156 seconds