フィルターのクリア

How to find biggest element of the array?

2 ビュー (過去 30 日間)
Rohan Repale
Rohan Repale 2013 年 4 月 8 日
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 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 4 月 8 日
what's wrong with:
max(max(A)) %?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2013 年 4 月 8 日

その他の回答 (1 件)

Cedric
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
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
Cedric
Cedric 2013 年 4 月 8 日
編集済み: Cedric 2013 年 4 月 8 日
Actually, the "biggest" element in your matrix A as defined by the original poster is 0, which is the absolute max. But I agree that "biggest" is not clear; however, the original poster clarifies the question by asking for an equivalent of max(max(A)).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by