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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by