Documentation

median

Median value of fixed-point array

Syntax

c= median(a)
c= median(a,dim)

Description

c= median(a)computes the median value of the fixed-point arrayaalong its first nonsingleton dimension.

c= median(a,dim)computes the median value of the fixed-point arrayaalong dimensiondim.dimmust be a positive, real-valued integer with a power-of-two slope and a bias of 0.

The input to themedianfunction must be a real-valued fixed-point array.

The fixed-point output arraychas the samenumerictypeproperties as the fixed-point input arraya. If the input,a, has a localfimath, then it is used for intermediate calculations. The output,c, is always associated with the defaultfimath.

Whenais an empty fixed-point array (value =[]), the value of the output array is zero.

Examples

Compute the median value along the first dimension of a fixed-point array.

x = fi([0 1 2; 3 4 5; 7 2 2; 6 4 9], 1, 32) % x is a signed FI object with a 32-bit word length % and a best-precision fraction length of 27 bits mx1 = median(x,1)

Compute the median value along the second dimension (columns) of a fixed-point array.

x = fi([0 1 2; 3 4 5; 7 2 2; 6 4 9], 1, 32) % x is a signed FI object with a 32-bit word length % and a best-precision fraction length of 27 bits mx2 = median(x, 2)

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

||

Introduced in R2010a

Was this topic helpful?