write a function to find maximum element of an array using recursion
古いコメントを表示
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 件のコメント
KSSV
2020 年 9 月 10 日
Good....so what is question for us?
回答 (1 件)
Ameer Hamza
2020 年 9 月 10 日
編集済み: Ameer Hamza
2020 年 9 月 10 日
0 投票
Check my answer to this question: https://www.mathworks.com/matlabcentral/answers/591043-recursive-function-to-calculate-max-number
カテゴリ
ヘルプ センター および File Exchange で MATLAB Coder についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!