Contents Previous Next Subchapters

Computing The Range of Data for Each Column
Syntax [min, max]  = colrange(x)
[min, max, minIdx, maxIdx]  = colrange(x)
See Also colmax , maxs , mins , colsum , colstd , colmean , colmedian , colmad

Description
Returns a row vector min containing the minimum values in each column of x, and a row vector max containing the maximum values in each column of x. The argument x is an integer, real or double-precision matrix. The returned values min and max have the same type and column dimension as x.

If present, the returned values minIdx and maxIdx are integer row vectors that contain the column index values of the returned min and max vectors. The vectors minIdx and maxIdx have the same column dimension as x.

Example
     x = [ {1, 2, 3}, {5, 3, 1}, {-2, -1, -3} ]
     [vMin, vMax ] = colrange(x)
     print vMin
     print vMax
returns
     [ 1 , 1 , -3 ] 
     [ 3 , 5 , -1 ] 
If you continue the example by entering
     [vMin, vMax, minIdx, maxIdx ] = colrange(x)
     print minIdx
     print maxIdx
O-Matrix will respond
     [ 1 , 3 , 3 ] 
     [ 3 , 1 , 2 ]