Cody

Problem 42858. Block average ignoring NaN values

Given a matrix, calculate the block average of each disjoint sub-matrix while ignoring NaN values. 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 = blknanavg(A,subsz)

Example:

    A = [1 2 3 4 5 6 7 8 NaN];
    subsz = [1  3];
    B = [2  5  (7+8)/2];

Hint: this is related to Problem 42856. Block average.

Solution Stats

46.43% Correct | 53.57% Incorrect
Last solution submitted on Sep 19, 2019

Problem Comments

Solution Comments