VMS Help  —  FORTRAN  Intrinsic Procedures, MERGE
  MERGE (tsource, fsource, mask)

  Class:  Elemental function - Generic

  Selects between two values or between corresponding elements in two
  arrays, according to the condition specified by a logical mask.

  The "tsource" and "fsource" can be scalars or arrays; they must
  have the same type and type parameters.  The "mask" is a logical
  array.

  The result type is the same as "tsource".  The value of "mask"
  determines whether the result value is taken from "tsource" (if
  "mask" is true) or "fsource" (if "mask" is false).

  Examples:

  For MERGE (1.0, 0.0, R < 0), if R is -3 the merge has the value
  1.0, while if R is 7 the merge has the value 0.0.

  Consider that TSOURCE is the array |1 3 5|, FSOURCE is the
                                     |2 4 6|

  array |8 9 0|, and MASK is the array |F T T|.
        |1 2 3|                        |T T F|

  MERGE (TSOURCE, FSOURCE, MASK) produces the result: |8 3 5|.
                                                      |2 4 3|
Close Help