Added a function to output the extreme value in a matrix.