# How can I calculate the "Median" of floating point numbers

4 views (last 30 days)

Show older comments

I have three two-dimensional arrays containing floating point numbers. I would like to construct a two-dimensional array that contains the "median" or middle value (not the mean) of the three arrays.

For example, if one element of the arrays contained 4.81, 3.54, and 3.56, I'd like to return 3.56, which is the middle value.

How can I do that?

##### 0 Comments

### Accepted Answer

James Tursa
on 9 Jun 2023

E.g.,

x = randi(10,2,3)

y = randi(10,2,3)

z = randi(10,2,3)

xyz = cat(3,x,y,z)

result = median(xyz,3)

##### 6 Comments

James Tursa
on 9 Jun 2023

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!