About maximum value in matrix
이전 댓글 표시
I have a problem regarding finding a maximum value from my matrix (largest element in the row)
I have matrix A shown bellow

I know that I can use
M=max(A,[],2)
Then I will get matrix M such that

But the answer I want is not that, what I want is that . The one that I want is

The answer that I want is the maximum value of each row ignoring the negativity of each value like shown in the matrix above.
I hope my question is clear enough.
채택된 답변
추가 답변 (1개)
Fangjun Jiang
2018년 8월 6일
0 개 추천
use abs() and note that the second return of max() gives the indices. See if you can figure it out.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!