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

Home » Public Forums » archive » set all elements in 2d array between some range to 1
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: set all elements in 2d array between some range to 1 [message #91008 is a reply to message #91007] Fri, 22 May 2015 14:58 Go to previous messageGo to previous message
havok2063 is currently offline  havok2063
Messages: 24
Registered: December 2012
Junior Member
My attempted solution was at the bottom. I love value_locate, and I've started tackling this with that but I got stuck. My problem seems a bit more complicated than the uses described on your page.

waved = wave[*]
uniwave = sort(waved)
minskywave = skywave - 3
maxskywave = skywave + 3

v1 = value_locate(minskywave, waved)
v2 = value_locate(maxskywave, waved)

This gives me the positions in minskywave and maxskywave where the elements in waved lie, but it's not the final answer. I can't combine my "values" array into one big array, because my skywave ranges overlap, and that will give me incorrect binning.

For each element in skywave, I need to find where waved is between skywave+-3, and set those indices to 1. The rest should be set to 0.

Any ideas on how to finish this? Or a simpler way than what I'm attempting. Thanks.


>
> Two ideas:
>
> http://www.idlcoyote.com/code_tips/valuelocate.html
> http://www.idlcoyote.com/code_tips/partition.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Function graphics and IDL widgets
Next Topic: Identify whether value is integer in IF statement

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

Current Time: Sun Oct 12 01:02:00 PDT 2025

Total time taken to generate the page: 1.04159 seconds