write a function to find maximum element of an array using recursion
Afficher commentaires plus anciens
function mx = recursion_max(v)
n=size(v);
if size(v) <2
mx = v(1);
else mx = max(recursion_max(v(n-1)), mx );
end
end
1 commentaire
KSSV
le 10 Sep 2020
Good....so what is question for us?
Réponses (1)
Ameer Hamza
le 10 Sep 2020
Modifié(e) : Ameer Hamza
le 10 Sep 2020
0 votes
Check my answer to this question: https://www.mathworks.com/matlabcentral/answers/591043-recursive-function-to-calculate-max-number
Catégories
En savoir plus sur MATLAB Coder 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!