How to find biggest element of the array?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am aware max(A) will give me the biggest element, however it gives me another array with all the biggest elements.
Is there a way to do something like max(max(A))?
채택된 답변
추가 답변 (1개)
Cedric
2013년 4월 8일
MAX works along a specific dimension (that you can specify using an extra arg). One way to find the overall max is to index A linearly and to pass this to MAX, e.g.:
max(A(:))
댓글 수: 2
Feng Cheng Chang
2013년 4월 8일
If A = [-1 0; -1000 -0.5], then px = max(A(:)) --> 0. The biggest element of the array is zero ?
We may perform as [px,i] = max(abs(A(:)); ax = A(i) --> -1000. The biggest element is then one thousand with minus sign !
FC Chang 4/7/2013
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!