Clear Filters
Clear Filters

matrix

1 view (last 30 days)
Mate 2u
Mate 2u on 28 May 2012
Hi, I have a very large matrix. I want to know how many positive elements I have in the matrix, and how many negative elements (non-zero).
Thanks

Accepted Answer

Oleg Komarov
Oleg Komarov on 28 May 2012
idx = A < 0;
nnz( idx) % negative
nnz(~idx) % positive (including 0)

More Answers (0)

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!