Let me explain my question with an example.
I have the matrix
$\begin{pmatrix}0 &5 &1 \\ 0&5&-1 \\ 10&-55&2 \\ 4&0&-1 \\ 1&1&1 \\\end{pmatrix}$
and I need to know the number of each row that has a $-1$ in its third column.
How I can do this efficiently?
Thanks!
sum(A(:,3))ornnz(A(:,3))will probably be faster – Luis Mendo Mar 27 '14 at 09:38