I need to iterate over a 2d array finding the maximum value inside a given kernel. However, the kernel is custom, not square.

Antworten (1)

Roger Stafford
Roger Stafford am 8 Mär. 2018
Bearbeitet: Roger Stafford am 8 Mär. 2018

0 Stimmen

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

Kategorien

Mehr zu MATLAB Parallel Server finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 8 Mär. 2018

Bearbeitet:

am 8 Mär. 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by