Median VI
- Updated2025-07-30
- 2 minute(s) read
Finds the median value of the input sequence X by sorting the values of X and averaging the middle element(s) of the sorted array.

Inputs/Outputs
X
—
X is the input sequence. If X is empty, median is NaN.
median
—
median is the calculated median value of the input sequence X.
error
—
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster. |
The Median VI finds median using the following identity.
where n is the number of elements in the input sequence X, s is the sorted sequence of X,
, and
.
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Mathematics\Probability and Statistics\Statistics Solver.vi
X
—
median
—
error
—