Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Write a function called maxsubsum that takes a matrix A as an input, computes the sum of elements in each of its submatrices, and finds the submatrix that has the maximum sum. If there are more than one with the same maximum sum, the function can pic
1 回表示 (過去 30 日間)
古いコメントを表示
[rows, columns] = size(A);
overallMaxSum = -inf;
for smColumns = 1 : columns
for smRows = 1 : rows
sumMatrix = conv2(inputMatrix, ones(smRows, smColumns), 'same');
maxValue = max(sumMatrix);
if maxValue > overallMaxSum
numrows = smRows;
numcols = smColumns;
end
end
end
1 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!