[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


ifthen Source code in ifthen.pro

ifthen

Name
           ifthen
Purpose
           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.
Category
           Misc.
Calling Sequence
           val = ifthen(expression,trueval[,falseval])
Input Parameters
           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.
Optional Input Parameters

Keyword Parameters

Output Parameters
           Returns val = trueval for those elements whose expression
           is not 0, otherwise the corresponding falseval element.
Optional Output

Common Blocks
           But no!
Side Effects
           None.
Restrictions
           Expression should be boolean. If not falseval is given the
           trueval type must be either float or integer value.
Procedure

Example
          y = sqrt(ifthen(x ge 0,x)) -> get square root for valid
              values only.
Revision History
          $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

Last modified by pro2html on 2005 January 04 at 16:39 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically