Filter löschen
Filter löschen

matrix

1 Ansicht (letzte 30 Tage)
Mate 2u
Mate 2u am 28 Mai 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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by