MATLAB: How to find the maximum number and minimum number in a matrix

arraymatrixmaximumminimum

I have this matrix
A=
300 300 300 300 300 300
262 262 262 262 262 262
238 218 218 218 218 218
210 192 260 260 260 192
239 221 288 251 251 220
241 223 290 253 245 222
I would like to find the maximum number and minimum number?

Best Answer

Hi, max(A) returns maximum element in case A is a vector. If A is a matrix then it returns a row vector of the maximum value of each column.
Here, you can do max(max(A)) to get the maximum element.Similarly min(min(A)) to get minimum element.