Ncol = 100;

M = rand (10);
M(:,1:6) = [];
M(1:6,:) = [];

R = (1:(size (M, 1)))' * (ones (1, size (M, 2)));  R = R(:);
C = (ones (size (M, 1), 1)) * (1:(size (M, 2)));   C = C(:);
w = M * 0.5;                                       w = w(:);
c = round (M * (Ncol - 1) + 1);                    c = c(:);

% coord = [x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4 ]
coord = [C-w , R-w , zeros(size(R)), ...
         C+w , R-w , zeros(size(R)), ...
         C+w , R+w , zeros(size(R)), ...
         C-w , R+w , zeros(size(R))];

coord = reshape (coord', 3, [])';

connec = reshape (1:(size (coord, 1)), 4, [])';

fv = [];
fv.vertices = coord;
fv.faces = connec;
fv.facecolor = 'flat';
fv.facevertexcdata = c;

figure;  colormap (jet (Ncol));  colorbar ();
patch (fv);
