maxv#

Purpose#

Performs an element by element comparison of two matrices and returns the maximum value for each element.

Format#

z = maxv(x, y)#
Parameters:
  • x (NxK matrix) – data

  • y (NxK matrix) – data

Returns:

z (NxK matrix) – values are the maximum of each element from the arguments x and y.

Examples#

// Create the sequence 1, 2, 3,...10
x = seqa(1, 1, 10);

// Set 'y' equal to the reverse order of 'x'
y = rev(x);

z = maxv(x, y);
    1       10       10
    2        9        9
    3        8        8
    4        7        7
x = 5    y = 6    z = 6
    6        5        6
    7        4        7
    8        3        8
    9        2        9
   10        1       10

Remarks#

maxv() works for sparse matrices as well as arrays.

See also

Functions minv()