max and min row from an array

조회 수: 2 (최근 30일)
Kanika Bhalla
Kanika Bhalla 2021년 1월 11일
댓글: garima sharma 2021년 1월 11일
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
garima sharma
garima sharma 2021년 1월 11일
A = [1 2;3 4;5 5;6 7;8 9;10 11;-2 -4];
m = max(A);
n = min(A);
mm = [m;n];

댓글을 달려면 로그인하십시오.

답변 (1개)

Daniel Pollard
Daniel Pollard 2021년 1월 11일
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.

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by