Help with calculating median of an array without using built in function?
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 26 Mär. 2016
0 Stimmen
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 Kommentar
Martin Kao
am 26 Mär. 2016
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!