Find the number of 1s in sections of a logical array

조회 수: 20 (최근 30일)
Adam Fitchett
Adam Fitchett 2019년 10월 25일
댓글: Adam Fitchett 2019년 10월 25일
I have a logical array (column vector) which has a length of 41,472. I need to find out how many ones there are in the first 288 rows of this array, in the second 288 rows, in the third 288 rows and so on until I have a column vector listing the number of ones in each successive 288 row-sized block of the logical array. How would I go about doing this?

채택된 답변

the cyclist
the cyclist 2019년 10월 25일
편집: the cyclist 2019년 10월 25일
sum(reshape(A,288,[]))'
where A is your original array.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by