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

Home » Public Forums » archive » Re: Array definition
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 definition [message #55273 is a reply to message #55271] Wed, 08 August 2007 10:38 Go to previous messageGo to previous message
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
On Aug 8, 1:18 pm, Yaswant Pradhan <Yaswant.Prad...@gmail.com> wrote:
> On Aug 8, 6:00 pm, Melanie <mkjone...@gmail.com> wrote:
>
>> Hi,
>> I am trying to check an array of about 19000 elements for values that
>> are above a certain value. I then want to save only the index of the
>> larger values in a new array.
>
> avoid FOR loop, use WHERE
> indices = where(array GT value, n_wh)
>
>
>
>> So, I am going through the original array with a for loop and checking
>> if each value is greater than 19:
>> for i=0, nelements-1 do begin
>> if (array1[i] gt 19) then...
>
>> Next, if the value in array1 is in fact greater than 19, I want to
>> save the value of i into a new array such as
>
>> if(array1[i] gt 19) then array2[...]=i
>
>> But I'm not sure how to make this work such that I can write each
>> subsequent i value for which the value in array1 is gt 19 into each
>> subsequenbt space in array2...
>
>> Any ideas? Please let me know if this question is not clear...

specifically:

array_size = size(array1, /dimensions)
array2 = fltarr(array_size)
w = where( array1 gt value, c )
if c gt 0 then array2[w] = array1[w]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Mac OS x IDL font handling
Next Topic: byte offset in POINT_LUN

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

Current Time: Sun Oct 12 07:08:04 PDT 2025

Total time taken to generate the page: 1.28413 seconds