Home » All Programs » Indexing The Biggest Or Lowest Value In A Matrix In MatLab

Indexing The Biggest Or Lowest Value In A Matrix In MatLab

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®.

How To Index The Biggest And The Lowest Element In A Matrix In Matlab®? (Illustrated Expression)

>> 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.

Conclusion

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.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Please

leave feedback ?

( For the post )

ASK THE MECHANICALLAND

COMMUNITY


We are always open to your feedback to improve ourselves and the quality of our content! If you have any suggestions, thoughts, or criticism, please let us know. We are trying to improve our blog with constructive feedback. We are aware of how valuable your feedback is for our future development, and we will carefully read all your comments. Thank you in advance!