How can I calculate summary of sub matrix in very large matrix ?

1 回表示 (過去 30 日間)
Una Jacimovic
Una Jacimovic 2018 年 7 月 17 日
回答済み: Image Analyst 2018 年 7 月 17 日
I have very large matrix which can be 1000*1000,how to create fast algorithm which calculates summary of submatrix if I have upper left corner, width and height?
Thanks!

採用された回答

Image Analyst
Image Analyst 2018 年 7 月 17 日
By "summary", I assume you mean "sum". If so, just do
subMatrix = m(topRow:topRow+height-1, leftCol:leftCol+width-1);
theSum = sum(subMatrix(:))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by