필터 지우기
필터 지우기

Finding maximum in a matrix

조회 수: 3 (최근 30일)
Rohan  Mehta
Rohan Mehta 2019년 6월 22일
댓글: KALYAN ACHARJYA 2019년 6월 24일
Suppose I have 1000x1 matrix and my data is from (50,60) and then from (160,170) and so on (i.e randomly distributed), What I want is to find maximum out of this 50 to 60 location and then maximum from 160 to 170 location and so on. How to find this ?
  댓글 수: 3
Rohan  Mehta
Rohan Mehta 2019년 6월 22일
index locations
Rohan  Mehta
Rohan Mehta 2019년 6월 22일
yes these locations are stored in another matrix

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

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 22일
편집: KALYAN ACHARJYA 2019년 6월 22일
Suppose mat is 1000x1 matrix
%this will give the maximum value within the matrix uptp 50 rows and 60 colm
mat1=mat(1:50,1:60);
max1=max(mat1(:));
You can do the same form other also
mat2=mat(1:160,1:170);
max2=max(mat2(:));
Is this you are looking for?
  댓글 수: 4
Rohan  Mehta
Rohan Mehta 2019년 6월 24일
Hello Sir this piece of code almost solved my problem As I have found all the maximums but one doubt is how to assign the location's of these maximum to another matrix ?
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 24일
how to assign the location's of these maximum to another matrix?
The second part of comment is not clear for me.
Are you looking for this one?
mat_other(r1,c1)
%..........^ index values from first matrix having maximum value

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by