The previous remark was absolutely correct, in my opinion, however, 1 peculiarity should be still specified. If the number of discrete-time samples is even (2,4,6,8,...) then median may be defined in 3 alternative ways:
Example: x = [2 5 7 9]
Median1 = 5;
Median2 = 7;
Median3 = (5+7)/2 = 6;
All 3 variants are fair, however usually either the 1st or the 3nd ones are prefered. Such problem will never arise while processing an odd sequence.
Usually, median filter is used for smoothing in order to get rid of jumps, outliers and other undesirable effects, which contaminate and distort signal. That's why the algorithm of median filtration (in Mathlab, for example) is:
S_new(i) = median ( S(i-n/2:i+n/2) ), where n - total number of samples, s - original signal and s_new - the final one. Of course, n may be changed if necessary. The more it is, the more smoothed is the signal.
With respect,
Dmitrij