Help with calculating median of an array without using built in function?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (2)
Azzi Abdelmalek
le 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 commentaire
Martin Kao
le 26 Mar 2016
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!