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 日間)
krushnasamy subramaniyan
krushnasamy subramaniyan 2015 年 6 月 15 日
閉鎖済み: Walter Roberson 2015 年 6 月 15 日
[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

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by