9.3.98 MERGE (TSOURCE, FSOURCE, MASK)

Description:  Selects between two values or between corresponding elements in two arrays, according to the condition specified by a logical mask. 
Class:  Elemental function; Generic 
Arguments:  TSOURCE   Must be a scalar or array (of any data type). 
  FSOURCE   Must be a scalar or array of the same type and type parameters as TSOURCE. 
  MASK Must be a logical array. 
Results:  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), R = -3 has the value 1.0, and R = 7 has the value 0.0.

TSOURCE is the array

  [ 1  3  5 ]
  [ 2  4  6 ],
FSOURCE is the array
  [ 8  9  0 ]
  [ 1  2  3 ],
and MASK is the array
  [ F  T  T]
  [ T  T  F].

MERGE (TSOURCE, FSOURCE, MASK) produces the result:

  [ 8  3  5 ]
  [ 2  4  3 ].


Previous Page Next Page Table of Contents