Find the max value in a kernal
9 ビュー (過去 30 日間)
古いコメントを表示
I need to iterate over a 2d array finding the maximum value inside a given kernel. However, the kernel is custom, not square.
0 件のコメント
回答 (1 件)
Roger Stafford
2018 年 3 月 8 日
編集済み: Roger Stafford
2018 年 3 月 8 日
Let M be your matrix. Let R be a vector of the matrix's row subscripts of your kernel, and let C be a vector of corresponding column subscripts of the kernel. Then do:
mx = max(M(sub2ind(size(M),R,C))); % mx is maximum of M in kernel
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!