필터 지우기
필터 지우기

How to find max in a matrix (1,N,2)&& matrix (1,N,3)?

조회 수: 3 (최근 30일)
tabw
tabw 2014년 9월 2일
편집: Salaheddin Hosseinzadeh 2014년 9월 2일
matrix (1,1:10,2)= 1 2 3 4 5 6 7 8 9 10
matrix (1,1:10,3)= 2 5 9 2 5 6 2 5 7 5
Is that a way can find out matrix (1,9,:)? which is largest considering both array. Two number are dependent. So I can't find it separately.
any embedded function to do it?
Or I must write a code to calculate their mean value and take the max one.

채택된 답변

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014년 9월 2일
편집: Salaheddin Hosseinzadeh 2014년 9월 2일
Hi Tabw,
You can add those numbers and then use "max" to find their value and their index.
m = matrix (1,1:10,2) + matrix (1,1:10,3) % so m = [1 2 3 4 5 6 7 8 9 10] + [2 5 9 2 5 6 2 5 7 5]
then find the max in m
[maxValue,maxIndex] = max(m)
Hope this helps.
Be aware of the fact that this is a simple add, you may wanna add their abs or define you're criteria.
Good Luck!

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by