% sum over all matrix elements of a matrix.

a = rand(4000,6000);
n = size(a,1);
m = size(a,2);

tic;

    total = 0.0;
for inrow = 1:n
for incol = 1:m
    total = total + a(inrow,incol);   % row-wise summation.
end
end

toc;
