median

Purpose

Computes the medians of the columns of a matrix.

Format

m = median(x)
Parameters:x (NxK matrix) – data
Returns:m (Kx1 vector) – contains the medians of the respective columns of x.

Examples

// Set the seed for repeatable random data
rndseed 4320993;

// Create uniform random integers between 1 and 10
x = ceil(10*rndu(100, 3));

// Calculate the median of each column of 'x'
md = median(x);

After the code above, md is equal to:

5.0000
5.0000
6.0000

Remarks

median() will return a missing value for any column that contains a missing value.

Source

median.src