# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# dsp.Median System object

Median value of input

## Description

The `Median` object computes the median value of the input. The object can compute the median along each dimension (row or column) of the input or of the entire input.

To compute the median of the input:

1. Define and set up your median System object™. See Construction.

2. Call `step` to compute the median according to the properties of `dsp.Median`. The behavior of `step` is specific to each object in the toolbox.

### Note

Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`med = dsp.Median` returns a median System object, `med`, that computes the median along the columns of the input using the `Quick sort` sorting method.

`med = dsp.Median('PropertyName',PropertyValue,...)` returns a median System object, `med`, with each property set to the value you specify.

## Properties

 `SortMethod` Sort method Specify the method the object should use to sort the data before computing the median. You can specify `Quick sort` or ```Insertion sort```. The quick sort algorithm uses a recursive sort method and is faster at sorting more than 32 elements. The insertion sort algorithm uses a nonrecursive method and is faster at sorting less than 32 elements. If you are using the `Median` object to generate code, you should use the insertion sort algorithm to prevent recursive function calls in your generated code. The default is ```Quick sort```. `Dimension` Dimension to operate along Specify the dimension along which the object computes the median values. You can specify one of | `All` | `Row` | `Column` | `Custom` |. The default is `Column`. `CustomDimension` Numerical dimension to operate along Specify the dimension of the input signal (as a one-based value), over which the object computes the median. The cannot exceed the number of dimensions in the input signal. This property applies only when you set the Dimension property to `Custom`. The default is `1`.

## Methods

 step Median value
Common to All System Objects
`clone`

Create System object with same property values

`getNumInputs`

Expected number of inputs to a System object

`getNumOutputs`

Expected number of outputs of a System object

`isLocked`

Check locked states of a System object (logical)

`release`

Allow System object property value changes

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

Compute the median value of the input column using the `dsp.Median` object.

``` med = dsp.Median; x = [7 -9 0 -1 2 0 3 5 -9]'; y = med(x)```
```y = 0 ```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the Median block reference page. The object properties correspond to the block properties, except:

 Treat sample-based row input as a column block parameter is not supported by the `dsp.Median` System object.