フィルターのクリア

Compute Mode of values in array greater than 0

3 ビュー (過去 30 日間)
Tyler Smith
Tyler Smith 2018 年 9 月 17 日
コメント済み: Tyler Smith 2018 年 9 月 17 日
I need to compute the mode from values in my array (9x9 array) greater than 0. This is because I only care about the values greater than 0 and 0 will more often than not be the mode. Any suggestions would be great. Thanks!

採用された回答

Stephan
Stephan 2018 年 9 月 17 日
編集済み: Stephan 2018 年 9 月 17 日
Hi,
here is a workaround using the properties of NaN :
A = [0 0 5; 0 0 0; 1 1 0;];
B=A;
B(A==0) = NaN;
res = mode(B);
disp(res)
Best regards
Stephan
  1 件のコメント
Tyler Smith
Tyler Smith 2018 年 9 月 17 日
Good idea, thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by