## Documentation Center |

Median value of array

`M = median( A)` returns
the median value of

If

`A`is a vector, then`median(A)`returns the median value of`A`.If

`A`is a nonempty matrix, then`median(A)`treats the columns of`A`as vectors and returns a row vector of median values.If

`A`is an empty 0-by-0 matrix,`median(A)`returns`NaN`.If

`A`is a multidimensional array, then`median(A)`acts along the first nonsingleton dimension and returns an array of median values. The size of this dimension reduces to`1`while the sizes of all other dimensions remain the same.

`median` computes natively in the numeric class
of `A`, such that `class(M) = class(A)`.

Was this topic helpful?