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

Home » Public Forums » archive » Re: a newbie question on code efficiency
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: a newbie question on code efficiency [message #26293 is a reply to message #26292] Sat, 18 August 2001 06:41 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dominic R. Scales (dominic.scales@aerosensing.de) writes:

> Hi David,
>
> this seems to be not true as b = a > cutoff sets the values smaller
> than cutoff to cutoff and keeps the others as they are.
>
> IDL> a=bindgen(10,10)
> IDL> b = a > 50
> IDL> print,a
> 0 1 2 3 4 5 6 7 8 9
> 10 11 12 13 14 15 16 17 18 19
> 20 21 22 23 24 25 26 27 28 29
> 30 31 32 33 34 35 36 37 38 39
> 40 41 42 43 44 45 46 47 48 49
> 50 51 52 53 54 55 56 57 58 59
> 60 61 62 63 64 65 66 67 68 69
> 70 71 72 73 74 75 76 77 78 79
> 80 81 82 83 84 85 86 87 88 89
> 90 91 92 93 94 95 96 97 98 99
> IDL> b= a > 50
> IDL> print,b
> 50 50 50 50 50 50 50 50 50 50
> 50 50 50 50 50 50 50 50 50 50
> 50 50 50 50 50 50 50 50 50 50
> 50 50 50 50 50 50 50 50 50 50
> 50 50 50 50 50 50 50 50 50 50
> 50 51 52 53 54 55 56 57 58 59
> 60 61 62 63 64 65 66 67 68 69
> 70 71 72 73 74 75 76 77 78 79
> 80 81 82 83 84 85 86 87 88 89
> 90 91 92 93 94 95 96 97 98 99
> IDL>
>
> the following does the trick:
>
> IDL> b[where(a le 50)] = 0
> IDL> b[where(a gt 50)] = 1
> IDL> print,b
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0
> 0 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1

Folks,

I'm writing "A GE 50" *not* (and I repeat, *not*) "A > 50".

IDL> print, a GE 50
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: object graphic / direct graphic
Next Topic: call_method

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

Current Time: Wed Oct 08 17:46:23 PDT 2025

Total time taken to generate the page: 0.00458 seconds