maximum = max(max(A)); [x,y]=find(A==maximum)
M = max(A)
maximum_array = max(x, y); % for a 31*31 matrix and finding max over all elements max = max(count1, [], 'all');