Search code examples
matlabmedian

How to calculate median of variables?


suppose i have few variables a, b, c, and d have some numerical values. How can I calculate their median in MATLAB?

x= median(a,b,c,d); is not working.

Note: a, b, c, and d are variables defined by a few equations and have numerical values.


Solution

  • median is expecting a vector:

    x= median([a,b,c,d]);