![]() |
Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, Germany |
![]() |
ifthen
This function returns a certain value if the expression is
true, otherwise the other value. This function can be used
as an "if statement in an expression" like the C ?: -
operator.
Other than the if statement this function works for arrays
also provided the dimensions of expression and true/false
values are the same.
Misc.
val = ifthen(expression,trueval[,falseval])
expression - boolean expression. For all elements which
are true the trueval element will be
returned, otherwise the falseval
trueval - Value or array to be returned when the
expression is logical true ( not zero).
falseval - (optional) Value or array to be returned when
the exression is logical false (zero). If
this value is not given 0 will be returned.
Returns val = trueval for those elements whose expression
is not 0, otherwise the corresponding falseval element.
But no!
None.
Expression should be boolean. If not falseval is given the
trueval type must be either float or integer value.
y = sqrt(ifthen(x ge 0,x)) -> get square root for valid
values only.
$Log: ifthen.pro,v $
Revision 1.1 2003/12/30 07:27:09 goehler
function to perform scalar/array boolean expression evaluation returning
alternative values
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]