Effacer les filtres
Effacer les filtres

How to find the maximum number in each row in a variable.

2 vues (au cours des 30 derniers jours)
Lester Lim
Lester Lim le 24 Jan 2013
Commenté : Bethelhem Biru le 10 Déc 2020
Lets say I have the following matrix:
1 2 3 4 5
2 3 3 3 3
2 2 2 2 5
how should I use max to get the larget number per row?

Réponse acceptée

Walter Roberson
Walter Roberson le 24 Jan 2013
max(YourArray, [], 2)
  2 commentaires
Lester Lim
Lester Lim le 24 Jan 2013
Yup, it works! thanks!
Bethelhem Biru
Bethelhem Biru le 10 Déc 2020
this will sisplay as a column matrix, if you want it to display as a row matrix, use the ' sign, for transposition. :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by