Filter löschen
Filter löschen

max and min row from an array

1 Ansicht (letzte 30 Tage)
Kanika Bhalla
Kanika Bhalla am 11 Jan. 2021
Kommentiert: garima sharma am 11 Jan. 2021
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 Kommentar
garima sharma
garima sharma am 11 Jan. 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];

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Daniel Pollard
Daniel Pollard am 11 Jan. 2021
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.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by