Contents Previous Next Subchapters Current Chapters-> prctile ftail tpdf ttail ittail cnormal inormal rand snormal seed colmad colmse colrange colmode kurtosis skewness randperm ranseed unifm0v1 unirnd normrnd exprnd gamrnd cauchyrnd gumbelrnd laplacernd lognrnd wblrnd binornd poissrnd exppdf expcdf normpdf unifpdf unifcdf wblpdf wblcdf colcor colcov colmean colstd colmax rowmax colsum rowsum colnorm rownorm median colmedian colmead colvar corr conv conv2 sum cumsum prod cumprod Parent Chapters-> Omatrix6 statistics median Search Tools-> contents reference index search

Computing The Median
 Syntax `median(`x`)` See Also colmedian , colmean , sort , psort

Description
If x is a vector, returns a scalar containing the median of the elements of x Otherwise, returns a row vector with the same column dimension as x and containing the median of each of the columns of x. The argument x is an integer, real, or double-precision matrix. The return value is a double-precision vector. ``` ```The median of an even number of elements is the average of the two central values. ``` ```New programs should be converted to use the colmedian function. The median() function may be deprecated in future versions. ``` ```Example
If you enter ```      x = {2, 3, 1}      median(x) ``` O-Matrix returns ```      2 ``` If you enter ```      x = [2, 4, 6, 8]      median(x) ``` O-Matrix returns ```      5 ```