median

median — median (row median, column median) of vector/matrix entries

Calling sequence

y=median(x)  
y=median(x,'r')  
y=median(x,'c')  

Parameters

x : real vector or matrix
y : scalar or vector

Description

For a vector or a matrix x, y=median(x) returns in the scalar y the median of all the entries of x.

y=median(x,'r') (or, equivalently, y=median(x,1)) is the rowwise median. It returns in each entry of the column vector y the median of each row of x.

y=median(x,'c') (or, equivalently, y=median(x,2)) is the columnwise median. It returns in each entry of the row vector y the median of each column of x.

Examples



A=[1,2,10;7,7.1,7.01];
median(A)
median(A,'r')
median(A,'c')
 
  

See also

sum, mean