max and min row from an array

let there is a 7x2 matrix
[1 2
3 4
5 5
6 7
8 9
10 11
-2 -4]
can i get a row that has min value and a row that has max value?

1 comentario

garima sharma
garima sharma el 11 de En. de 2021
A = [1 2;3 4;5 5;6 7;8 9;10 11;-2 -4];
m = max(A);
n = min(A);
mm = [m;n];

Iniciar sesión para comentar.

Respuestas (1)

Daniel Pollard
Daniel Pollard el 11 de En. de 2021

0 votos

The built in min and max commands have the ability to return the index of the largest and smallest values in an array. The documentation explains all of the inputs you can make, and all of the outputs that will result in.

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de En. de 2021

Comentada:

el 11 de En. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by