MINMEANGRID

Finds the region in a matrix with the minimum mean for a given size grid.

You are now following this Submission

Finds the region in a matrix with the minimum mean for a given size grid.

i.e.) If Z is 4 by 4 and the grid size is 2 by 2 (GridSize = [2 2]),
then the minimum 2 by 2 grid mean would be 2.25 = mean([4 2 1 2])
and is located in the region identified below.

Z = [ 1 3 5 7 ]
[ ------ ]
[ |4 2| 7 8 ]
[ | | ]
[ |1 2| 1 1 ]
[ ------ ]
[ 8 7 9 6 ]

Here, ii_min = [2 3] (rows 2 and 3) and jj_min = [1 2] (columns 1 and 2).
Therefore, Z(ii_min,jj_min) = [4 4]
[1 2]

gridmin - the minimum grid region value (2.25 in the example above)
gridave - a matrix containing all of the grid region averages
ii_min - indices of the rows in Z with the region containing minimum mean
jj_min - indices of the columns in Z with the region containing minimum mean

Ex.)
Z = [1 3 10 7;4 12 7 8;10 2 1 1;8 7 2 6];

[gridmin,gridave,ii_min,jj_min] = minmeangrid(Z,[2 3]);
Z
Zsub = Z(ii_min,jj_min)
gridave
gridmin

Cite As

Sww (2026). MINMEANGRID (https://www.mathworks.com/matlabcentral/fileexchange/4522-minmeangrid), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Sparse Matrices in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0