Help with calculating median of an array without using built in function?
Show older comments
A=[8 6 7 5 3 0 9]
b=sort(A)
b= 0 3 5 6 7 8 9
Now what are the next steps?
Accepted Answer
More Answers (2)
Azzi Abdelmalek
on 26 Mar 2016
0 votes
use n=numel(A) to get the number of element in A. If n is odd, the median will be b((n+1)/2), if n is even, try to find out.
1 Comment
Martin Kao
on 26 Mar 2016
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!