how to find the number of negative cells in matrix ?

9 ビュー (過去 30 日間)
yosra
yosra 2022 年 11 月 12 日
コメント済み: Voss 2022 年 11 月 12 日
how to find the number of negative cells in matrix

採用された回答

Voss
Voss 2022 年 11 月 12 日
A = randn(5) % 5-by-5 random matrix
A = 5×5
-0.1182 1.1458 -0.7931 -1.2282 -0.4492 1.9749 -0.0542 -0.3788 0.2144 -1.0333 1.3979 1.2310 2.3602 0.7574 -0.1836 0.6968 -0.3670 -1.5154 0.6693 -0.6576 0.4933 1.8072 2.2063 0.2762 -1.3458
nnz(A < 0) % number of elements of A that are < 0
ans = 12
  2 件のコメント
yosra
yosra 2022 年 11 月 12 日
thanks it worked
Voss
Voss 2022 年 11 月 12 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by