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

Home » Public Forums » archive » Re: Division in a conditional statement
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: Division in a conditional statement [message #36282] Sun, 31 August 2003 18:49 Go to previous message
MKatz843 is currently offline  MKatz843
Messages: 98
Registered: March 2002
Member
>> Can anybody tell me what does this mean:
>>
>> x= a LT total(abs(b))/1e7/NFREE
>>
>> where:
>> b= an array of floating point numbers
>> a= a floating point number
>> NFREE= an integer
>>

> x= a LT (total(abs(b))/1e7/NFREE)

In addition to what David wrote, you may have been asking a
very basic question.

The LT (less-than) operator returns true=1 or false=0, and it is
evaluated for each element in the arrays "a" and the temporary array
David put in parantheses above. So x will be an array of 1s and 0s, 1
wherever the less-than statement is true.

Here are a few examples. The behavior is a little different if either
a or b is scalar, or if a and b have multiple elements but their
lengths do not match.

IDL> print, [1,2,3,4,5] LT [3,3,3,3,3]
1 1 0 0 0 ;-- evaluated element-by-element
IDL> print, [1,2,3,4,5] LT [0,0,10,1,2]
0 0 1 0 0 ;-- similar to the above
IDL> print, [1,2,3,4,5] LT 3
1 1 0 0 0 ;-- all elements are compared to this scalar
IDL> print, [1,2,3,4,5] LT [5,5]
1 1 ;-- only the first two elements are compared
IDL> print, [1,2,3,4,5] LT [3,3,3,3,3,3,3,3]
1 1 0 0 0 ;-- only 5 elements are compared


In the last two examples, where the lengths do not match, the result
has the length of the smaller of the two arrays.

Likewise if the 3 in the third example is replaced with [3], a
one-element array, then the result will only have one element as well.

You'll get this same kind of behavior from the other comparison
operators, GT, EQ, LE, and GE.

M. Katz
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Pause the program
Next Topic: mpeg resolution in MS-Windows

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

Current Time: Sat Oct 11 06:32:28 PDT 2025

Total time taken to generate the page: 2.47839 seconds