In some cases, you need to calculate the biggest value of a matrix in Matlab®. The max() command and min() command can calculate only the biggest values of each row of a matrix in Matlab®. In this article, we will show you how to calculate the biggest or the lowest values of a matrix in Matlab®.
>> a = [263 62 626; 65 56 562; 5412 12621 26]; min(min(a)) max(max(a)) ans = 26 ans = 12621 >>
Consider a situation that you want to index the biggest or the lowest value of the matrix ‘a’ as shown above. You can calculate the whole row’s biggest and lowest values of matrix ‘a’ with min() and max() commands in Matlab®.
What you need to do is, you need to recalculate the biggest or the lowest value of each row that was calculated previously. This can be done by typing ‘min(min(a))’ for the lowest value of matrix ‘a’ or ‘max(max(a))’ for the biggest value of matrix ‘a’ as shown above.
So it is simple like that to calculate the biggest and the lowest value of matrices in Matlab®.
Do not forget to leave your comments and questions below about the use of the ‘max()’ and the ‘min()’ commands in Matlab® below.
If you want further coding examples about the ‘max()’ and the ‘min()’ in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.