write a function to find maximum element of an array using recursion
1 次查看(过去 30 天)
显示 更早的评论
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 个)
Ameer Hamza
2020-9-10
编辑:Ameer Hamza
2020-9-10
Check my answer to this question: https://www.mathworks.com/matlabcentral/answers/591043-recursive-function-to-calculate-max-number
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!