Given a matrix, calculate the block average of each disjoint sub-matrix of the same size. Assume that the size of the matrix along each dimension is an integer multiple of the size of the sub-matrix along the same dimension.

  • Input: matrix A and the size of each sub-matrix subsz
  • Output: B = blkavg(A,subsz)

Example:

    A = [2  0  1  3  5  7];
    subsz = [1  2];
    B = [1  2  6];

Hint: this is related to Problem 42854. Crunch that matrix!.

Next problem: Problem 42858. Block average ignoring NaN values

Solution Stats

101 Solutions

45 Solvers

Last Solution submitted on Dec 01, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...